Show contents 

Dimensions > Dimensions Assembly Interfaces > ICustomDimLevels > ICustomDimLevels.FindByKey

ICustomDimLevels.FindByKey

Syntax

FindByKey(IndexKey: Integer): ICustomDimLevel;

Parameters

IndexKey. Level key used for search.

Description

The FindByKey method searches level by its key.

Comments

The method returns level parameters in case of successive search and Null, if level is not found.

Example

Executing the example requires a standard cube with the CUBE_1 identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Cube: IStandardCube;
    CustDim: ICustomDimension;
    CustLevs: ICustomDimLevels;
    CustLevel: ICustomDimLevel;
    s: String;
Begin
    MB := MetabaseClass.Active;
    Cube := MB.ItemById("CUBE_1").Bind As IStandardCube;
    CustDim := Cube.FactDimension.Dimension As ICustomDimension;
    CustLevs := CustDim.Levels;
    If CustLevs.Count <> 0 Then
        CustLevel := CustLevs.FindByKey(5834);
        If CustLevel <> Null Then
            s := CustLevel.Name;
        End If;
    End If;
End Sub UserProc;

After executing the example the method searches for fact dimension level with the key 5834, and if the search is successful, the "s" variable contains name of the found level.

See also:

ICustomDimLevels