IDimOrmCondition.EvaluateRec

Fore Syntax

EvaluateRec(Value: IOrmRecord): Boolean;

Fore.NET Syntax

EvaluateRec(Value: Prognoz.Platform.Interop.Orm.IOrmRecord): Boolean;

Parameters

Value. The collection of attribute values implemented by the  IOrmRecord interface that should be tested.

Description

The EvaluateRec method tests attribute values and determines whether they meet the search conditions.

Comments

This method is used to evaluate MDM dictionaries' elements. You can get attribute value implemented by the   interface using the property  IRdsDictionaryElementData.Record.

Fore Example

Executing the example requires a form, a button named Button1 positioned on this form, the RdsDictionaryBox component named RdsDictionaryBox1 and the UiRdsDictionary component used as a data source for RdsDictionaryBox1. The MDM dictionary linked to the UiRdsDictionary component, contains the Name and UserAttr attributes.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        RdsInst: IRdsDictionaryInstance;
        Search: IRdsDictionaryElementsSearch;
        Cond: IDimOrmCondition;
        Crit: IDimTextCriteria;
        Elems: IRdsDictionaryElements;
        Elem: IRdsDictionaryElement;
        i: Integer;
    Begin
        RdsInst := RdsDictionaryBox1.Source.Instance;
        Search := RdsInst.CreateSearch;
        Search.Attributes.Attributes := "Name;UserAttr";
        Crit := New DimTextCriteria.Create;
        Crit.CriteriaOptions := TextCriteriaOptions.SearchStringAttributes
            Or TextCriteriaOptions.FreeText;
        Crit.Text := "Population income";
        Cond := Search.Condition;
        Cond.SetTextCriteria(Crit);
        Elems := RdsInst.Elements;
        For i := 0 To Elems.Count - 1 Do
            Elem := Elems.Item(i);
            Debug.WriteLine(Elem.Name + ": Satisfies search conditions - " +
                Cond.EvaluateRec(Elem.Record).ToString);
        End For;
    End Sub Button1OnClick;

After executing the example clicking the button creates an object for finding MDM dictionary elements. Search condition is selected. Next, all elements are checked for meeting the search conditions. Element names and checking results are displayed in development environment console.

Fore.NET Example

Executing the example requires a .NET form, a button named Button1 positioned on this form, the RdsDictionaryBoxNet component named RdsDictionaryBoxNet1 and the UiRdsDictionaryNet component used as data source for RdsDictionaryBoxNet1, and the TextBox component named TextBox1. The MDM dictionary linked to the UiRdsDictionaryNet component, contains the Name and UserAttr attributes.

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        RdsInst: IRdsDictionaryInstance;
        Search: IRdsDictionaryElementsSearch;
        Cond: IDimOrmCondition;
        Crit: DimTextCriteria;
        Elems: IRdsDictionaryElements;
        Elem: IRdsDictionaryElement;
        i: Integer;
        ElemList: List < string >;
    Begin
        RdsInst := RdsDictionaryBoxNet1.Source.Instance;
        Search := RdsInst.CreateSearch();
        Search.Attributes.Attributes := "Name;UserAttr";
        Crit := New DimTextCriteria();
        Crit.CriteriaOptions := TextCriteriaOptions.tecropSearchStringAttributes
            Or TextCriteriaOptions.tecropFreeText;
        Crit.Text := "Population income";
        Cond := Search.Condition;
        Cond.SetTextCriteria(Crit);
        Elems := RdsInst.Elements;
        ElemList := New List < string > ();
        For i := 0 To Elems.Count - 1 Do
            Elem := Elems.Item[i];
            ElemList.Add(Elem.Name + ": Satisfies search conditions - " +
                Cond.EvaluateRec(Elem.Record).ToString());
        End For;
        TextBox1.Lines := ElemList.ToArray();
    End Sub;

After executing the example clicking the button creates an object for finding MDM dictionary elements. Search condition is selected. Next, all elements are checked for meeting the search conditions. Element names and the results of checking are displayed in the TextBox1 component.

See also:

IDimOrmCondition