IDimTextCriteria.CriteriaOptions

Syntax

CriteriaOptions: TextCriteriaOptions;

Description

The CriteriaOptions property sets search options.

Example

To execute the example, place on the form the Label component named LABEL1, EditBox named EDITBOX1, two Button components named BUTTON1, BUTTON2, the DimensionTree component named DEMENTIONTREE1, UiDimension name UIDEMENTION1 and MetabaseOpenDialog named METABASEOPENDIALOG1.

Change values of the Text property for the components: Label - the Search Text value, set empty value for EditBox, set the Button component named BUTTON1 to Search, set the BUTTON1 component to Open. For the DimensionTree component set the Dimention property to UiDimension1.

Add links to the Dimensions and Metabase system assemblies.

Class UserProc: Form
    EditBox1: EditBox;
    Button1: Button;
    Button2: Button;
    Label1: Label;
    UiDimension1: UiDimension;
    MetabaseOpenDialog1: MetabaseOpenDialog;
    DimensionTree1: DimensionTree;
    
Function Search(DimInst: IDimInstance; SearchStr: String): IDimSelection;
Var
    Result: IDimSelection;
    TextCriteria: IDimTextCriteria;
    OrmManager: IDimOrmManager;
Begin
    If IsNull(dimInst) Or searchStr.IsEmpty Then
        Return Result;
    End If;
    TextCriteria := New DimTextCriteria.Create;
    TextCriteria.CriteriaOptions := TextCriteriaOptions.LikeText Or TextCriteriaOptions.SearchStringAttributes;
    TextCriteria.Text := SearchStr;
    Result := DimInst.CreateSelection;
    OrmManager := New DimOrmManager.Create;
    OrmManager.CreateCondition(DimInst.Dimension, TextCriteria).SelectElements(Result);
    Return Result;
End Function search;

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
    UiDimension1.Selection := Search(UiDimension1.DimInstance, EditBox1.Text);
End Sub Button1OnClick;

Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
    If MetabaseOpenDialog1.Execute(Self) Then
        UiDimension1.Active := False;
        UiDimension1.Dimension := MetabaseOpenDialog1.Object.Bind As IDimensionModel;
        UiDimension1.Active := True;
    End If;
End Sub Button2OnClick;
End Class UserProc;

After starting the form click the Open button and select a dictionary. As a result, the form displays hierarchical list of dictionary elements. Enter text to search and click the Search button. As a result, the selection in the lists is changed: only the elements corresponding to search criteria are selected.

See also:

IDimTextCriteria