CurrentOffset: Integer;
The CurrentOffset property returns the number of hierarchy levels from dictionary root to elements set.
To get current element in the set, use the IMetaMembersSet.Current method.
Executing the example requires a time series database with the TSDB identifier.
Add links to the Cubes, Metabase, Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Rubr: IMetabaseObject;
RubrInst: IRubricatorInstance;
Facts: IMetaDictionaryInstance;
Hierarchy: IMetaHierarchy;
HInstance: IMetaHierarchyInstance;
Members: IMetaMembers;
Begin
MB := MetabaseClass.Active;
Rubr := MB.ItemById("TSDB").Bind;
RubrInst := Rubr.Open(Null) As IRubricatorInstance;
Facts := RubrInst.GetDictionary(RubricatorDictionary.Facts);
Hierarchy := Facts.Dictionary.DefaultHierarchy;
HInstance := Facts.OpenHierarchy(Hierarchy);
Members := HInstance.GetRootMembers;
Members.Reset;
Debug.WriteLine("Number of hierarchy levels: " + Members.CurrentOffset.ToString);
Debug.WriteLine("Names of root elements in the hierarchy:");
Debug.Indent;
While Not Members.Eof Do
Debug.WriteLine(Members.Current.Name);
Members.Next;
End While;
Debug.Unindent;
End Sub UserProc;
After executing the example the console displays the following:
Number of hierarchy levels.
Name of root elements in factors hierarchy.
See also: