SelectElements(Criteria: IDimTextCriteria; Selections: IDimSelectionSet);
Criteria - search condition.
Selections - element selection.
The SelectElements method generates an element selection meeting the conditions.
In the example the form contains the following components: UiDimension, DimensionCombo, Button, EditBox. The OnClick event is described for the button.
Class UserForm: Form
txtPattern: EditBox;
Button1: Button;
uidimCountries: UiDimension;
dcCountries: DimensionCombo;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
pDim : IDimInstance;
pManager: IDimOrmManager;
pCriteria : IDimTextCriteria;
pFactory : IDimSelectionSetFactory;
pSelections : IDimSelectionSet;
pSelection : IDimSelection;
Begin
pManager := New DimOrmManager.Create;
pDim := dcCountries.Selection.Dimension;
pFactory := New DimSelectionSetFactory.Create;
pSelections := pFactory.CreateDimSelectionSet;
pSelection := pSelections.Add(pDim);
pCriteria := New DimTextCriteria.Create;
pCriteria.CriteriaOptions := TextCriteriaOptions.FreeText Or TextCriteriaOptions.SearchName;
pCriteria.Text := txtPattern.Text;
pManager.SelectElements(pCriteria, pSelections);
pSelection.CopyTo(dcCountries.Selection, True);
End Sub Button1OnClick;
End Class UserForm;
Start the form, type in the text to be searched, and click the button; after this only the elements, names of which contain the entered text, are selected in drop-down dimension menu.
See also: