IDimAttributeProbe.Probe

Syntax

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

Parameters

Dimension - dimension.

Attribute - dimension attribute.

Description

The Probe method checks attribute: if the attribute is set to True, search is based on this attribute. To use this method, set the IDimTextCriteria.CriteriaOptions property to SearchProbeAttributes.

Example

In the example the form contains the following components: two UiDimension, two EditBox, two DimensionCombo components, and Button component. The OnClick event is described for the button, the OnShow event is described for the form.

Class UserForm: 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 identifier of time series database

Inst := (Cat As IMetabaseObject).Open(Null) As 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 UserForm;

 

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