IDimElements.NextSibling

Syntax

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

Fore.NET Syntax

NextSibling[Element: uinteger; Through: boolean]: uinteger;

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.

Fore 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:

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Elem: IDimElements;
    i, j, k: uinteger;
Begin
    MB := Params.Metabase;
    Dimen := MB.ItemById["D_TO"].Open(NullAs IDimInstance;
    Elem := Dimen.Elements;
    i := 21;
    System.Diagnostics.Debug.WriteLine("Index of current element: " + i.ToString());
    j := Elem.PrevSibling[i, False];
    System.Diagnostics.Debug.WriteLine("Index of previous element: " + j.ToString());
    k := Elem.NextSibling[i, False];
    System.Diagnostics.Debug.WriteLine("Index of the next element: " + k.ToString());
End Sub;

See also:

IDimElements