The following parameters are available to set up value editor using binding string:
Name of the parameter |
Type | Description | Mandatory |
ID | String | Dictionary identifier or key. | Yes |
ATTRIBUTEVALUE | String | Dictionary attribute which values will form cell value. By default the Identifier(ID) attribute is used. |
Yes |
LEVELATTR | String | It sets the attribute, which determines view type of level names in the drop-down list. A specific attribute can be set for each dictionary level. The value for this parameter is determined by the following string: 0{X1*Y1,X2*Y2,...,Xn*Yn}, where: X1-Xn is the dictionary level key, for which displayed attribute should be selected; Y1-Yn is the dictionary attribute key, which values will be displayed as element names for the specified level. | None |
SELECTIONMODE | String | It determines dictionary element selection mode in the control. The following values can be determined as the parameter values:
|
None |
GROUP | String | Identifier of a group of elements. | None |
SCHEMA | String | Identifier of the selection schema. | None |
NAME | String | The dictionary attribute key, which determines view type of level name in drop-down list. It is used if the dictionary has one level. | None |
MULTISELECT | Logical | Availability of multiple selection. | None |
PARAMVALUEx PARAMID_[ident] |
It enables the user to set up value of input parameters if the parametric dictionary is used as a drop-down list. The corresponding parameter can be set in two ways: 1) The parameters of the PARAMVALUEx type are added to the binding string, where x is the parameter number in the list of dictionary parameters (1,2, etc.), for example, PARAMVALUE1 = "10". 2) The parameters of the PARAMID_[ident] type are added to the binding string, where [ident] is the parameter identifier in the list of dictionary parameters, for example, PARAMID_Item = "10". |
None | |
DISPLAYATTRIBUTEVALUE | String | It determines the attribute of the dictionary use to display to footer or header. | None |
RDS | String | MDM repository identifier where dictionary is stored. | None |
DS_KEY | Integer | Data source key of regular report, for which calculated points are created. | None |
DIM_KEY | Integer | Dimension key, for which the value editor is created. | None |
PT_KEY | Integer | Calculated point key created for data source. | None |
CUSTOMMULTISELECTTEXT | String | Template, according to which editor text is created in case of multiple selection. Creating the template may require any text and the following substitutions:
|
None |
Logical values are set as a character string of the ON/OFF or the True/False type.
The cell displays element names. The value contained in the cell is the value of the attribute determined in the ATTRIBUTEVALUE parameter. If several elements are selected, the cell value is the value array of the specified dictionary attribute.
NOTE. The following conditions should be met on moving the cell in editing mode for correct restitution of dictionary selection used in the DimCombo control:
Value type in the cell corresponds to the attribute type of the dictionary which values will be used to generate the cell value - ATTRIBUTEVALUE.
A unique index should be created in the dictionary by the ATTRIBUTEVALUE attribute.
Parametric dictionaries enable the user to specify values of input parameters. The value of corresponding parameter can be set in two ways:
Parameters of the PARAMVALUEx type are added to binding string, where x is the number of the parameter in the list of dictionary parameters (1,2, etc.), for example, PARAMVALUE1 = "10".
Parameters of the PARAMID_[ident] type are added to the binding string, where [ident] is the parameter identifier in the list of dictionary parameters, for example, PARAMID_Item = "10".
Context menu for the DimCombo element looks as follows:
NOTE. The Select group and Display group context menu items are present if there is no restriction for visible dictionary elements from dictionary selection group, that is, the GROUP parameter is not set.
UI="DimCombo" ID="CALENDAR" ATTRIBUTEVALUE="NAME" LEVELATTR="0{4*4}" MULTISELECT="True" PARAMID_YEAR_START="2000" PARAMID_YEAR_FINISH="2020"
UI="DimCombo" ID="@1033" ATTRIBUTEVALUE="NAME"
Executing the example requires a form that contains the Button component with the Button1 identifier, the TabSheetBox component with the TabSheetBox1 identifier and the UiTabSheet component with the UiTabSheet1 identifier. Determine the UiTabSheet1 data source for the TabSheetBox1 component. The dictionary with the D_TO identifier is used as a data source, the dictionary structure contains several levels and a group of elements. The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
DimDesc: IMetabaseObjectDescriptor;
BM: IBindingManager;
DimChildren: IMetabaseObjectDescriptors;
DimModel: IDimensionModel;
DimInst: IDimInstance;
Selection: IDimSelection;
Group: IDimElementGroup;
Schema: IDimSelectionSchema;
LvlKey, AttrKey: Integer;
DimComboBinding: IBindingDimCombo;
Begin
MB := MetabaseClass.Active;
DimDesc := MB.ItemById("D_TO");
BM := New BindingManager.Create;
DimModel := DimDesc.Bind As IDimensionModel;
DimChildren := DimDesc.Children;
//Setting up parameters
DimComboBinding := BM.CreateByUi("DimCombo") As IBindingDimCombo;
//Check the existence of the group of elements of the selection schema
//It is expected that the first child object is a group of elements,
//the second is the selection schema
If DimChildren.Count >= 2 Then
Group := DimChildren.Item(0).Bind As IDimElementGroup;
Schema := DimChildren.Item(1).Bind As IDimSelectionSchema;
DimComboBinding.Group := (Group As IMetabaseObject).Id;
DimComboBinding.Schema := (Schema As IMetabaseObject).Id;
//Creating values from names
DimInst := DimDesc.Open(Null) As IDimInstance;
Selection := DimInst.CreateSelection;
Schema.ProcessInplace(Selection, Group);
DimComboBinding.ValueAttribute := "NAME";
DimComboBinding.ValueDefined := True;
DimComboBinding.Value := Selection.ToString;
End If;
//Identifiers as the name of level elements if the level exists
If DimModel.Levels.Count >= 1 Then
LvlKey := DimModel.Levels.Item(1).Key;
AttrKey := DimModel.Attributes.Id.Key;
DimComboBinding.LevelAttribute := "0{" + LvlKey.ToString + "*" + AttrKey.ToString + "}";
End If;
DimComboBinding.Object := DimDesc.Id;
//Multiple selection
DimComboBinding.SelectionMode := SelectionModeEnum.MultiSelect;
UiTabSheet1.TabSheet.Cell(0, 0).Style.Binding := DimComboBinding.AsString;
End Sub Button1OnClick;
Clicking the button sets the value editor for the A0 table cell. When the cell is edited, the dictionary drop-down list is displayed. The list of elements will contain elements included into dictionary group of elements, on the first opening the elements included into dictionary selection schema are selected. Identifiers are displayed as the first level element value, multiple selection option is on. After the selection is set, the cell value is generated from selected elements.
Executing the example requires a form that contains the Button component with the button1 identifier, the TabSheetBoxNet component with the TabSheetBoxNet1 identifier and the UiTabSheetNet component with the UiTabSheetNet1 identifier. Determine the UiTabSheetNet1 data source for the TabSheetBoxNet1 component. The dictionary with the D_TO identifier is used as a data source, the dictionary structure contains several levels and a group of elements. The example handles the Click event for the button1 component.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
MB: IMetabase;
DimDesc: IMetabaseObjectDescriptor;
BM: IBindingManager = New BindingManager();
DimChildren: IMetabaseObjectDescriptors;
DimModel: IDimensionModel;
DimInst: IDimInstance;
Selection: IDimSelection;
Group: IDimElementGroup;
Schema: IDimSelectionSchema;
LvlKey, AttrKey: UInteger;
DimComboBinding: IBindingDimCombo;
Begin
MB := Self.Metabase;
DimDesc := MB.ItemById["D_TO"];
DimModel := DimDesc.Bind() As IDimensionModel;
DimChildren := DimDesc.Children;
//Set up parameters
DimComboBinding := BM.CreateByUi("DimCombo") As IBindingDimCombo;
//Check if the group of elements of the selection schema is present
//It is expected that the first child object is a group of elements,
//the second is the selection schema
If DimChildren.Count >= 2 Then
Group := DimChildren.Item[0].Bind() As IDimElementGroup;
Schema := DimChildren.Item[1].Bind() As IDimSelectionSchema;
DimComboBinding.Group := (Group As IMetabaseObject).Id;
DimComboBinding.Schema := (Schema As IMetabaseObject).Id;
//Create values from names
DimInst := DimDesc.Open(Null) As IDimInstance;
Selection := DimInst.CreateSelection();
Schema.ProcessInplace(Selection, Group);
DimComboBinding.ValueAttribute := "NAME";
DimComboBinding.ValueDefined := True;
DimComboBinding.Value := Selection.ToString("", ",", False);
End If;
//Identifiers as the name of level elements if the level exists
If DimModel.Levels.Count >= 1 Then
LvlKey := DimModel.Levels.Item[1].Key;
AttrKey := DimModel.Attributes.Id.Key;
DimComboBinding.LevelAttribute := "0{" + LvlKey.ToString() + "*" + AttrKey.ToString() + "}";
End If;
DimComboBinding.Object := DimDesc.Id;
//Multiple selection
DimComboBinding.SelectionMode := SelectionModeEnum.semodMultiSelect;
UiTabSheetNet1.TabSheetUi.TabSheet.Cell[0, 0].Style.Binding := DimComboBinding.AsString;
End Sub;
The result of Fore.NET example execution matches with that in the Fore example.