FindByKey(hierarchyKey: Integer): IDimHierarchy;
hierarchyKey - key of alternative hierarchy.
The FindByKey method searches for an alternative hierarchy in the collection by hierarchy key.
Executing the example requires that the repository contains a dictionary with the TB_BASE identifier.
Sub Main;
Var
Mb: IMetabase;
OriginalModelObj: IMetabaseObject;
OriginalModel: IDimensionModel;
Hierarchies: IDimHierarchies;
Hierarchy: IDimHierarchy;
Begin
Mb := MetabaseClass.Active;
OriginalModelObj := Mb.ItemById("TB_BASE").Edit;
OriginalModel := OriginalModelObj As IDimensionModel;
Hierarchies := OriginalModel.Hierarchies;
Hierarchy := Hierarchies.FindByKey("1");
If Hierarchy <> Null Then
Debug.WriteLine(" Name: " + Hierarchy.Name);
Debug.WriteLine(" ID: " + Hierarchy.Id);
End If;
End Sub Main;
After executing the example development environment console displays information on alternative hierarchy with the key 1 if the TB_BASE dictionary contains such a hierarchy.
See also: