NextSibling(Element: Integer; [Through: Boolean]): Integer;
Element. Element index.
Through. Optional parameter which determines whether transition to the elements of the same level of another parent will be executed. By default False.
The NextSibling property returns index of the next element with respect to selected one taking into account parent and level. The property returns -1 if there is no next element.
To get index of the previous element relative the selected one, use the IDimElements.PrevSibling property.
Executing the example requires that the repository contains a dictionary with the D_TO identifier.
Add links to the Metabase and Dimensions system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Dimen: IDimInstance;
Elem: IDimElements;
i, j, k: Integer;
Begin
MB := MetabaseClass.Active;
Dimen := MB.ItemById("D_TO").Open(Null) As IDimInstance;
Elem := Dimen.Elements;
i := 21;
Debug.WriteLine("Index of current element: " + i.ToString);
j := Elem.PrevSibling(i, False);
Debug.WriteLine("Index of previous element: " + j.ToString);
k := Elem.NextSibling(i, False);
Debug.WriteLine("Index of the next element: " + k.ToString);
End Sub UserProc;
After executing the example the console displays:
Index of current element.
Index of previous element.
Index of the next element.
See also: