IRdsDictionaryInstance.CreateSearch

Fore Syntax

CreateSearch: IRdsDictionaryElementsSearch;

Fore.NET Syntax

CreateSearch: Prognoz.Platform.Interop.Rds.IRdsDictionaryElementsSearch;

Description

The CreateSearch method creates an object that searches MDM dictionary elements with advanced search features.

Comments

Unlike the search object created with the CreateLookup method, this search is based on various criteria.

Fore 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;
        Res: IRdsDictionaryElementList;
    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 citizens;
        Search.SetTextCriteria(Crit);
        Res := Search.FindAllList;
        Debug.WriteLine(Res.Count);
    End Sub Button1OnClick;

After executing the example while pressing the button elements of the MDM dictionary are searched with specified parameters of search criterion. Search is executed on values of specified attributes. The number of found elements is displayed in the development environment console.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        RdsInst: IRdsDictionaryInstance;
        Search: IRdsDictionaryElementsSearch;
        Crit: DimTextCriteria;
        Res: IRdsDictionaryElementList;
    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 := "Income of citizen";
        Search.SetTextCriteria(Crit);
        Res := Search.FindAllList();
        Text := Res.Count.ToString();
    End Sub;

See also:

IRdsDictionaryInstance