IMetaMember.SetConditions

Syntax

SetConditions(Conditions: IOrmConditions; Recursive: Boolean; PrevLevelIndex: Integer);

Parameters

Conditions. Condition.

Recursive. Parameter that determines whether child elements of a specified level are displayed in hierarchy.

PrevLevelIndex. Hierarchy level.

Description

The SetConditions method sets conditions of element existence in hierarchy.

Example

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 indicators hierarchy.

Sub UserProc;
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(NullAs IRubricatorInstance;
    DictInst := CatInst.GetDictionary(RubricatorDictionary.Facts);
    HierarchyInst := DictInst.DefaultHierarchy;
    Debug.WriteLine("Before changing conditions");
    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, False0);
            Mems.Next;
        Until Mems.Eof;
    End If;
    Debug.WriteLine("");
    Debug.WriteLine("After changing conditions");
    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 UserProc;

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:

IMetaMember