IDimElements.NextSibling

Syntax

NextSibling(Element: Integer; [Through: Boolean]): Integer;

Parameters

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.

Description

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.

Comments

To get index of the previous element relative the selected one, use the IDimElements.PrevSibling property.

Example

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(NullAs 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:

See also:

IDimElements