DimInstance: IDimInstance;
The DimInstance property returns the dictionary data that should be displayed in the component.
Executing the example requires that the repository contains a dictionary with the DICT_1 identifier. There should also be a web form and the DimensionCombo component named DimensionCombo1 on the form. The specified procedure is set as a handler of the OnShow event for the web form.
Add links to the Dimensions and Metabase system assemblies.
Sub TESTWebFormOnShow;
Var
Mb: IMetabase;
Dim: IDimInstance;
Sel: IDimSelection;
Begin
Mb := MetabaseClass.Active;
// Open dictionary
Dim := Mb.ItemById("DICT_1").Open(Null) As IDimInstance;
// Create selection
Sel := Dim.CreateSelection;
Sel.SelectElement(2, False);
Sel.SelectElement(4, False);
Sel.SelectElement(6, False);
// Connect dictionary to component
DimensionCombo1.DimInstance := Dim;
DimensionCombo1.Selection := Sel;
End Sub TESTWebFormOnShow;
When the web form is started, the specified dictionary is connected to the DimensionCombo1 component. Three elements will be selected.
See also: