FindByKey(IndexKey: Integer): IDimLevelInstance;
IndexKey — level key on which the search is based.
The FindByKey method searches level by its key and returns object containing level of dictionary elements if the search is successful.
Sub Main;
Var
MB: IMetabase;
Dimen: IDimInstance;
Levels: IDimLevelsInstance;
Level: IDimLevelInstance;
s: String;
Begin
MB:=MetabaseClass.Active;
Dimen:=MB.ItemById("D_TO").Open(Null) As IDimInstance;
Levels:=Dimen.Levels;
Level:=Levels.FindByKey(104);
If Level<>Null Then
s:=Level.Name;
End If;
End Sub Main;
After executing the example the method searches for the level with the key 104, and the "s" variable shows name of the found level if the search is successful.
See also: