IDimSelection.FirstDimElement

Fore Syntax

FirstDimElement: Integer;

Fore.NET Syntax

FirstDimElement: uinteger;

Description

The FirstDimElement property returns the first selected element of the dictionary.

Comments

To get the last selected element of the dictionary, use the IDimSelection.LastDimElement method.

Fore Example

Executing the example requires a dictionary with the 6443 key in the repository.

Add links to the Metabase and Dimensions system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Selection: IDimSelection;
    Elem: IDimElements;
    First, Last: Integer;
    s: String;
Begin
    MB := MetabaseClass.Active;
    Dimen := MB.Item(6443).Open(NullAs IDimInstance;
    Selection := Dimen.CreateSelection;
    // add all elements to selection
    Selection.SelectAll;
    // the first selected element of the dictionary
    First := Selection.FirstDimElement;
    // the last selected element of the dictionary
    Last := Selection.LastDimElement;
    Elem := Dimen.Elements;
    Debug.WriteLine("All elements: ");
    Debug.Indent;
    Debug.WriteLine(Selection.ToString("NAME"));
    Debug.Unindent;
    s := Elem.Name(First);
    Debug.WriteLine("First element (" + First.ToString + ") " + s);
    s := Elem.Name(Last);
    Debug.WriteLine("Last element (" + Last.ToString + ") " + s);
End Sub UserProc;

After executing the example the console window shows values of the first and the last elements of the dictionary.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Selection: IDimSelection;
    Elem: IDimElements;
    First, Last: uinteger;
    s: String;
Begin
    MB := Params.Metabase;
    Dimen := MB.Item[6443].Open(NullAs IDimInstance;
    Selection := Dimen.CreateSelection();
    // add all elements to selection
    Selection.SelectAll();
    // the first selected element of the dictionary
    First := Selection.FirstDimElement;
    // the last selected element of the dictionary
    Last := Selection.LastDimElement;
    Elem := Dimen.Elements;
    System.Diagnostics.Debug.WriteLine("All elements: ");
    System.Diagnostics.Debug.Indent();
    System.Diagnostics.Debug.WriteLine(Selection.ToString("NAME"","True));
    System.Diagnostics.Debug.Unindent();
    s := Elem.Name[First];
    System.Diagnostics.Debug.WriteLine("First element (" + First.ToString() + ") " + s);
    s := Elem.Name[Last];
    System.Diagnostics.Debug.WriteLine("Last element (" + Last.ToString() + ") " + s);
End Sub;

See also:

IDimSelection