IDimSelection.FirstDimElement

Syntax

FirstDimElement: Integer;

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.

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.

See also:

IDimSelection