IDimSimpleAttrProbe.Probe

Syntax

Probe(Dimension: IOrmSimpleClass;

Attribute: IOrmSimpleAttr): Boolean;

Parameters

Dimension. Object implemented by the IOrmSimpleClass interface. Dictionary or MDM repository can be passed as parameter value.

Attribute. Attribute implemented by the IOrmSimpleAttr interface that should be checked. Dictionary attribute or attribute of MDM dictionary can be passed as parameter value.

Description

The Probe method checks attribute and returns whether it is possible to search by the given attribute.

Comments

This method must be redetermined in custom class. If this method returns True, the search is based on this attribute, otherwise, it does not.

To use this method, set the IDimTextCriteria.CriteriaOptions property to SearchProbeAttributes.

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.

Class TestForm: Form
    Button1: Button;
    UiRdsDictionary1: UiRdsDictionary;
    RdsDictionaryBox1: RdsDictionaryBox;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        RdsInst: IRdsDictionaryInstance;
        Search: IRdsDictionaryElementsSearch;
        Crit: IDimTextCriteria;
        Keys: IRdsDictionaryElementArray;
    Begin
        RdsInst := RdsDictionaryBox1.Source.Instance;
        Search := RdsInst.CreateSearch;
        Crit := New DimTextCriteria.Create;
        Crit.CriteriaOptions := TextCriteriaOptions.SearchProbeAttributes
            Or TextCriteriaOptions.FreeText;
        Crit.SimpleProbe := New MyProbe.Create;
        Crit.Text := "Population income";
        Search.SetTextCriteria(Crit);
        Keys := Search.FindAll;
    End Sub Button1OnClick;

End Class TestForm;

Class MyProbe: Object, IDimSimpleAttrProbe
    Public Function Probe(Dimension: IOrmSimpleClass; Attribute: IOrmSimpleAttr): Boolean;
    Begin
        Return (Attribute.Id = "NAME"Or (Attribute.Id = "USERATTR");
    End Function Probe;
End Class MyProbe;

After executing the example clicking the button creates an object for finding MDM dictionary elements. Search condition is selected. Attributes by values of which the search should be performed are defined using the Probe custom method. The system object of custom class MyProbe is used as checking object. After search the Keys variable contains the array of found elements keys.

See also:

IDimSimpleAttrProbe