WhereIsEmpty: TriState;
WhereIsEmpty: Prognoz.Platform.Interop.ForeSystem.TriState;
The WhereIsEmpty property determines whether empty records are present in hierarchy.
Available values of WhereIsEmpty:
TriState.OnOption. Search is executed only in empty records.
TriState.OffOption. Search is executed only in non-empty records.
TriState.Undefined. Default value. Search is executed in all records.
If WhereIsEmpty <> Undefined, the IMetaHierarchyLevel.IncludeAll property must be False.
Executing the example requires a time series database with the FC_IS_EMPTY identifier. This database includes an indicator of empty factors. Add links to the Metabase, Cubes and Rds system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubrObj: IMetabaseObject;
CatInst: IRubricatorInstance;
DictInst: IMetaDictionaryInstance;
HierarchyInst: IMetaHierarchyInstance;
Mems: IMetaMembersSet;
Begin
Mb := MetabaseClass.Active;
RubrObj := Mb.ItemById("FC_IS_EMPTY").Bind;
CatInst := RubrObj.Open(Null) As IRubricatorInstance;
DictInst := CatInst.GetDictionary(RubricatorDictionary.Facts);
HierarchyInst := DictInst.DefaultHierarchy;
HierarchyInst.WhereIsEmpty := TriState.OnOption;
HierarchyInst.Build;
Mems := HierarchyInst.GetRootMembers;
ShowMembers(Mems);
End Sub UserProc;
Sub ShowMembers(Mems: IMetaMembersSet);
Var
Mem: IMetaMember;
Ml: IMetaMemberLeaf;
Begin
If Not Mems.Eof Then
Repeat
Mem := Mems.Current;
If Mem.IsLeaf Then
Ml := Mem As IMetaMemberLeaf;
Debug.WriteLine(" " + Mem.Name + " IsEmpty = " + Ml.IsEmpty.ToString);
Else
Debug.WriteLine(Mem.Name);
If Not Mem.Children.IsEmpty Then
ShowMembers(Mem.Children.GetMembers);
End If;
End If;
Mems.Next;
Until Mems.Eof;
End If;
End Sub ShowMembers;
After executing the UserProc procedure, the console window displays the time series database hierarchy that contains only empty factors.
Executing the example requires a time series database with the FC_IS_EMPTY identifier. This database has an indicator of empty factors.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
RubrObj: IMetabaseObject;
CatInst: IRubricatorInstance;
DictInst: IMetaDictionaryInstance;
HierarchyInst: IMetaHierarchyInstance;
Mems: IMetaMembersSet;
Begin
Mb := Params.Metabase;
RubrObj := Mb.ItemById["FC_IS_EMPTY"].Bind();
CatInst := RubrObj.Open(Null) As IRubricatorInstance;
DictInst := CatInst.GetDictionary(RubricatorDictionary.rubdicFacts);
HierarchyInst := DictInst.DefaultHierarchy();
HierarchyInst.WhereIsEmpty := TriState.tsOnOption;
HierarchyInst.Build();
Mems := HierarchyInst.GetRootMembers();
ShowMembers(Mems);
End Sub;
Public Shared Sub ShowMembers(Mems: IMetaMembersSet);
Var
Mem: IMetaMember;
Ml: IMetaMemberLeaf;
s: string;
Begin
If Not Mems.Eof() Then
Repeat
Mem := Mems.Current();
If Mem.IsLeaf Then
Ml := Mem As IMetaMemberLeaf;
s := " " + Mem.Name + " IsEmpty = " + Ml.IsEmpty.ToString();
System.Diagnostics.Debug.WriteLine(s);
Else
System.Diagnostics.Debug.WriteLine(Mem.Name);
If Not Mem.Children.IsEmpty Then
ShowMembers(Mem.Children.GetMembers());
End If;
End If;
Mems.Next();
Until Mems.Eof();
End If;
End Sub;
After executing the Main procedure, the console window displays the time series database hierarchy that contains only empty factors.
See also: