IRdsDictionaryElementsSearch.FindFirstElement

Syntax

FindFirstElement: IRdsDictionaryElement;

Description

The FindFirstElement method searches the first element that meets search conditions and returns parameters of the found element if search was successful.

Comments

This method returns Null if element was not found.

Example

Executing the example requires a form with the Button1 button, the RdsDictionaryBox component named RdsDictionaryBox1, and the UiRdsDictionary component that is a data source for RdsDictionaryBox1. The MDM dictionary that is connected to the UiRdsDictionary component has the attributes Name and UserAttr.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        RdsInst: IRdsDictionaryInstance;
        Search: IRdsDictionaryElementsSearch;
        Crit: IDimTextCriteria;
        Elem: IRdsDictionaryElement;
    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 := Income of the population;
        Search.SetTextCriteria(Crit);
        Elem := Search.FindFirstElement;
        Debug.WriteLine(Elem.Name);
        Elem := Search.FindNextElement(Elem);
        Debug.WriteLine(Elem.Name);
    End Sub Button1OnClick;

After executing the example, pressing the button searches the first two elements of the MDM dictionary with the specified parameters of search criterion. Search is executed on values of specified attributes. Names of the found elements are displayed in the development environment console.

See also:

IRdsDictionaryElementsSearch