Text: String;
The Text property determines text to be searched.
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
EditBox1: EditBox;
uidimCountries: UiDimension;
dcCountries: DimensionCombo;
uidimIndicator: UiDimension;
dcIndicator: DimensionCombo;
EditBox2: EditBox;
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; // 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;
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.CriteriaOptions := TextCriteriaOptions.LikeText Or TextCriteriaOptions.SearchStringAttributes;
Criteria.Text := EditBox2.Text;
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;
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 that meet search criterion remain selected.
See also: