IDimAttributeProbe.Probe

Syntax

Probe(Dimension: IDimensionModel; Attribute: IDimAttribute): Boolean;

Parameters

Dimension. Dictionary.

Attribute. Dictionary attribute.

Description

The Probe method checks if search can be executed by values of the specified dictionary attribute.

Comments

The method must be redefined in a user class. If the method returns True, search is executed by values of the specified attribute. If the method returns False, the attribute is not used for element search.

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

Example

Executing the example requires a form and the components on the form: two UiDimension components, two EditBox components, two DimensionCombo components, Button. The OnClick event is described for the button, the OnShow event is described for the form.

Class TestForm: Form
    Memo1: Memo;
    EditBox1: EditBox;
    uidimCountries: UiDimension;
    dcCountries: DimensionCombo;
    uidimIndicator: UiDimension;
    dcIndicator: DimensionCombo;
    Label1: Label;
    Label2: Label;
    EditBox2: EditBox;
    Label3: Label;
    Button1: Button;
    Mb: IMetabase;
    Cat: IRubricator;
    Inst: IRubricatorInstance;
    pAttrs: IMetaAttributes;

    Sub UserFormOnShow(Sender: Object; Args: IEventArgs);
    Begin
        Mb := MetabaseClass.Active;
        Cat := Mb.ItemById(EditBox1.Text).Bind As IRubricator; // EditBox1.Text contains time series database identifier
        Inst := (Cat As IMetabaseObject).Open(NullAs IRubricatorInstance;
        pAttrs := Inst.Facts.Dictionary.Attributes;
        uidimCountries.Object := pAttrs.FindById("COUNTRY").ValuesObject;
        uidimIndicator.Object := pAttrs.FindById("INDICATOR").ValuesObject;
    End Sub UserFormOnShow;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        selections: IDimSelectionSet;
        factory: IDimSelectionSetFactory;
        FactLookup: IRubricatorFactsLookup;
        MetaLookup: IMetaDictionaryLookup;
        Criteria: IDimTextCriteria;
        ObjProbe: MyProbe;
    Begin
        factory := New DimSelectionSetFactory.Create;
        selections := factory.CreateDimSelectionSet;
        selections.Add(dcCountries.Dimension.DimInstance);
        selections.Add(dcIndicator.Dimension.DimInstance);
        dcCountries.Selection.CopyTo(selections.Item(0), True);
        dcIndicator.Selection.CopyTo(selections.Item(1), True);
        FactLookup := Inst.CreateFactsLookup;
        MetaLookup := FactLookup.Lookup;
        Criteria := New DimTextCriteria.Create;
        Criteria.SelectOptions := ConditionSelectOptions.SelectedOnly;
        Criteria.CriteriaOptions := TextCriteriaOptions.SearchProbeAttributes Or TextCriteriaOptions.FreeText;
        Criteria.Text := EditBox2.Text;
        ObjProbe := New MyProbe.Create;
        Criteria.Probe := ObjProbe;
        selections := FactLookup.SetTextCriteria(Criteria, selections);
        selections.Item(0).CopyTo(dcCountries.Selection, True);
        selections.Item(1).CopyTo(dcIndicator.Selection, True);
    End Sub Button1OnClick;

End Class TestForm;

Public Class MyProbe: Object, IDimAttributeProbe
    Public Function Probe(Dimension: IDimensionModel; Attribute: IDimAttribute): Boolean;
    Begin
        Return (Attribute.Name = "SpecialName");
    End Function Probe;
End Class MyProbe;

Start the form and select desired element in drop-down dimension lists, next type in the text to be searched and click the button; list selection changes: only the elements, SpecialName attributes of which contain entered text, remain selected.

See also:

IDimAttributeProbe