IDimIndexInstance.LookUpLevel

Fore Syntax

LookUpLevel(IndexAttributesValues: Variant; Level: Integer): Integer;

Fore.NET Syntax

LookUpLevel(IndexAttributesValues: object; Level: uinteger): uinteger;

Parameters

IndexAttributesValues. Values of attributes on which search is carried out.

Level. Level at which search is carried out.

Description

The LookUpLevel method searches element in specified dictionary level.

Comments

The method returns "-1": if element with search value is not found.

If the Level parameter is set to "-1", the search is carried out whatever the level is.

Fore Example

Executing the example requires that repository contains table dictionary with the DIM_SEP identifier which consists of two levels.

Add links to the Dimensions, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    dimension: IDimensionModel;
    instance: IDimInstance;
    levels: IDimLevels;
    level: IDimLevel;
    attrs: IDimAttributes;
    attr: IDimAttribute;
    indexesinstance: IDimIndexesInstance;
    indexinstance: IDimIndexInstance;
    arr: array Of Variant;
    i, n: integer;
Begin
    // Get repository
    mb := MetabaseClass.Active;
    // Get access to dictionary data
    instance := mb.ItemById("DIM_SEP").Open(NullAs IDimInstance;
    // Create array for search
    Arr := New Variant[1];
    // Get collection of dictionary indexes
    indexesinstance := instance.Indexes;
    // Get the first dictionary index
    indexinstance := indexesinstance.Item(0);
    // Search the "1000" element
    Arr[0] := 1000;
    // Get element sequence number
    i := indexinstance.LookUpLevel(Arr, 1);
    // Display to the console order number
    Debug.WriteLine("Sequence number of found element = " + i.ToString);
End Sub UserProc;

After executing the example the console displays order number of dictionary search element.

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;
    instance: IDimInstance;
    indexesinstance: IDimIndexesInstance;
    indexinstance: IDimIndexInstance;
    arr: array Of object;
    i: uinteger;
Begin
    // Get repository
    mb := Params.Metabase;
    // Get access to dictionary data
    instance := mb.ItemById["DIM_SEP"].Open(NullAs IDimInstance;
    // Create array for search
    Arr := New object[1];
    // Get collection of dictionary indexes
    indexesinstance := instance.Indexes;
    // Get the first dictionary index
    indexinstance := indexesinstance.Item[0];
    // Find the "1000" element
    Arr[0] := 1000;
    // Get element sequence number
    i := indexinstance.LookUpLevel(Arr, 1);
    // Display sequence number to the console
    System.Diagnostics.Debug.WriteLine("Sequence number of found element = " + i.ToString());
End Sub;

See also:

IDimIndexInstance