SetConditions(Conditions: IOrmConditions; Recursive: Boolean; PrevLevelIndex: Integer);
Conditions. Condition.
Recursive. Parameter that determines whether child elements of a specified level are displayed in hierarchy.
PrevLevelIndex. Hierarchy level.
The SetConditions method sets conditions of element existence in hierarchy.
Executing the example requires that the repository contains a time series database with the OBJ_FC identifier.This database must have the INDICATOR attribute that is a root attribute in the factors hierarchy.
Sub Main;
Var
Mb: IMetabase;
RubrObj: IMetabaseObject;
CatInst: IRubricatorInstance;
DictInst: IMetaDictionaryInstance;
HierarchyInst: IMetaHierarchyInstance;
Mems: IMetaMembersSet;
Mem: IMetaMember;
Conditions: IOrmConditions;
Cond: IOrmCondition;
Begin
Mb := MetabaseClass.Active;
RubrObj := Mb.ItemById("OBJ_FC").Bind;
CatInst := RubrObj.Open(Null) As IRubricatorInstance;
DictInst := CatInst.GetDictionary(RubricatorDictionary.Facts);
HierarchyInst := DictInst.DefaultHierarchy;
Debug.WriteLine(Before conditions are changed);
Mems := HierarchyInst.GetRootMembers;
If Not Mems.Eof Then
Mem := Mems.Current;
Repeat
Debug.WriteLine(" " + Mem.Name);
Conditions := HierarchyInst.CustomWhere;
Conditions.Clear;
Cond := Conditions.Add;
Cond.AttributeName := "INDICATOR";
Cond.Value := 1009;
Mem.SetConditions(Conditions, False, 0);
Mems.Next;
Until Mems.Eof;
End If;
Debug.WriteLine("");
Debug.WriteLine(After conditions are changed);
Mems := HierarchyInst.GetRootMembers;
If Not Mems.Eof Then
Mem := Mems.Current;
Repeat
Debug.WriteLine(" " + Mem.Name);
Mems.Next;
Until Mems.Eof;
End If;
End Sub Main;
After executing the example, names of root elements of attributes hierarchy are displayed in the console window before and after a condition is created.
See also: