IDimOrmClass.CreateCondition

Syntax

CreateCondition: IDimOrmCondition;

Description

The CreateCondition method creates an object used to work with conditions.

Example

In the example the form contains the following components: UiDimension, DimensionTree, Button. The OnClick event is described for the button.

Class MyForm: Form
    dtree: DimensionTree;
    cmdSelect: Button;
    uidim: UiDimension; 
    
    Sub cmdSelectOnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        pDimModel : IDimensionModel;
        pManager : IDimOrmManager;
        pClass : IDimOrmClass;
        pCond : IDimOrmCondition;
        pCondition : IOrmCondition;
        pDimElement : IDimElement;
        pDim : IDimInstance;
        pDimElements : IDimElementArray;
        i : Integer;
    Begin
        pDim := uidim.DimInstance;
        pDimModel := uidim.Dimension;
        pManager := New DimOrmManager.Create;
        pClass := pManager.CreateClass(pDimModel);
        pCond := pClass.CreateCondition;
        pCondition := pCond.Conditions.Add;
        pCondition.AttributeName := "TEMP1";
        pCondition.Operator_ := OrmComparisonOperator.IsNotNull;
        pDimElement := pDim.NewElement;
        pDimElements := pDim.Elements.Elements;
        For i := 0 To pDimElements.Count - 1 Do
            pDimElement.Element := pDimElements.Element(i);
            If pCond.Evaluate(pDimElement) Then
                dtree.Selection.SelectElement(pDimElement.Element, False);
            End If;
        End For;
    End Sub cmdSelectOnClick;
End Class MyForm;

Start the form and click the button, tree selection changes: only the elements with non-empty value of the TEMP1 attribute remain selected.

See also:

IDimOrmClass