CurrentOffset: Integer;
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.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Rubr: IMetabaseObject;
RubrInst: IRubricatorInstance;
Facts: IMetaDictionaryInstance;
Hierarchy: IMetaHierarchy;
HInstance: IMetaHierarchyInstance;
Members: IMetaMembers;
Begin
MB := Params.Metabase;
Rubr := MB.ItemById["TSDB"].Bind();
RubrInst := Rubr.Open(Null) As IRubricatorInstance;
Facts := RubrInst.GetDictionary(RubricatorDictionary.rubdicFacts);
Hierarchy := Facts.Dictionary.DefaultHierarchy;
HInstance := Facts.OpenHierarchy(Hierarchy);
Members := HInstance.GetRootMembers();
Members.Reset();
System.Diagnostics.Debug.WriteLine("Number of hierarchy levels: " + Members.CurrentOffset.ToString());
System.Diagnostics.Debug.WriteLine("Names of root elements in the hierarchy:");
System.Diagnostics.Debug.Indent();
While Not Members.Eof() Do
System.Diagnostics.Debug.WriteLine(Members.Current().Name);
Members.Next();
End While;
System.Diagnostics.Debug.Unindent();
End Sub;
See also: