The DimCombo Value Editor

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:
  • SingleSelect - single element selection. The focused element is always selected.
  • SingleSelectNullable - single element selection. The focused element can be deselected. Navigating the elements selects the focused element. When the context menu is opened in the element area, the element is focused but not selected.
  • MultiSelect - advanced mode of multiple selection. Multiple selection is executed on selecting an element, the moving by elements does not make the element deselection. Holding down the CTRL key adds all child elements to a selection. When the context menu is opened in the element area, the element is focused, but not selected.
  • MultiSelectStandard - standard mode of multiple selection. Multiple selection is executed by holding down the SHIFT or CTRL keys, navigating the elements makes the element deselection and selection of focused element.
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
NAMESPACE String The path to the dictionary, which elements will be displayed in the value editor. The sequence of nested objects to dictionary, as a value, is specified as follows: <container_1 identifier>.<container_2 identifier>. ... .<container_n identifier>. 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".
To specify the data type that has the sent value, one can add one of the values of the ForeVariantType enumeration before the value. The data type and the value are separated with a colon.
Example:
  • PARAMVALUE1 = "4:10". The 10 value will be sent as a real value.
  • PARAMID_Item = "2:True". The True value will be sent as a string.
None
DISPLAYATTRIBUTEVALUE String It determines the attribute of the dictionary use to display to footer or header. 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:
  • %First. Name of the first selected element.
  • %Last. Name of the last selected element.
  • %Count. Number of selected elements.
  • %TotalCount. Number of nodes in a tree.
None

Logical values are set as a character string of the ON/OFF or the True/False type.

Features of Application

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. When turning a cell in the edit mode for correct recovery of selection of the dictionary used in the DimCombo control, it is required that the value type in the cell matches with the attribute type of the dictionary, which values are used to create a cell value - ATTRIBUTEVALUE. A unique index should also be created in the dictionary by the ATTRIBUTEVALUE attribute.

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.

Binding String

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"

Example

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(NullAs 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(00).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.

Back