Group: String;
The Group property determines value of the GROUP parameter in binding string.
The GROUP parameter determines identifier of the group of elements that delimits elements available in the editor.
The Group property is available if the IBindingDimCombo.GroupDefined property is set to True. If the Group property is changed, the GroupDefined property is automatically set to True.
Function CreateDimComboBinding(Dimension: IMetabaseObjectDescriptor): String;
Var
BM: IBindingManager;
DimChildren: IMetabaseObjectDescriptors;
DimModel: IDimensionModel;
DimInst: IDimInstance;
Selection: IDimSelection;
Group: IDimElementGroup;
Schema: IDimSelectionSchema;
LvlKey, AttrKey: Integer;
DimComboBinding: IBindingDimCombo;
Begin
BM := New BindingManager.Create;
DimModel := Dimension.Bind As IDimensionModel;
DimChildren := Dimension.Children;
// Set up parameters
DimComboBinding := BM.CreateByUi("DimCombo") As IBindingDimCombo;
// Check if there is group of elements and selection schema
// It is assumed that the first child object is group of elements,
// the second child object is 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 := Dimension.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 level element names if the level exists
If DimModel.Levels.Count >= 1 Then
LvlKey := DimModel.Levels.Item(0).Key;
AttrKey := DimModel.Attributes.Id.Key;
DimComboBinding.LevelAttribute := "0{" + LvlKey.ToString + "*" + AttrKey.ToString + "}";
End If;
DimComboBinding.Object := Dimension.Id;
// Multiple selection
DimComboBinding.SelectionMode := SelectionModeEnum.MultiSelect;
// Sorting
DimComboBinding.SortDirection := DimComboSortDirection.Descending;
// Template for creating name in multiple selection
DimComboBinding.CustomMultiselectText := "Range: %First-%Last";
Return DimComboBinding.AsString;
End Function CreateDimComboBinding;
This function generates a binding string to use the value editor as a drop-down list of the dictionary. Dictionary description is sent as the Dimension input parameter. Depending on the dictionary structure, the following is set in editor settings: group of elements and selection schema, format of first-level element names. The value in the cell will be formed by means of element names.
See also: