Group: String;
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 GroupDefined property is set to True. If the Group property is changed, the GroupDefined property is automatically set to True.
Function CreateDimComboBidning(Dimension: IMetabaseObjectDescriptor): String;
Var
BM: IBindingManager;
DimChildren: IMetabaseObjectDescriptors;
DimModel: IDimensionModel;
DimInst: IDimInstance;
Selection: IDimSelection;
Group: IDimElementGroup;
Schema: IDimSelectionSchema;
RdsDict: IRdsDictionary;
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 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 := 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 the name of level elements 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;
//If the MDM dictionary is from the MDM repository, specify the RDS parameter
If Dimension.Bind Is IRdsDictionary Then
RdsDict := Dimension.Bind As IRdsDictionary;
If RdsDict.RdsDatabaseInstance <> Null Then
DimComboBinding.Rds := (RdsDict.RdsDatabaseInstance.Database As IMetabaseObject).Id;
End If;
End If;
//Multiple selection
DimComboBinding.SelectionMode := SelectionModeEnum.MultiSelect;
//Template for creating a name on multiple selection
DimComboBinding.CustomMultiselectText := "Range: %First-%Last";
Return DimComboBinding.AsString;
End Function CreateDimComboBidning;
This function generates a binding string to use the value editor as a drop-down list of the dictionary. Dictionary description is passed as the Dimension input parameter. Depending on the dictionary structure in editor settings the following options will be specified: group of elements and selection schema, first level elements name format; for the MDM dictionary the MDM repository will be specified. The value in the cell will be formed by means of element names.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Rds;
Function CreateDimComboBidning(Dimension: IMetabaseObjectDescriptor): String;
Var
BM: BindingManager = New BindingManagerClass();
DimChildren: IMetabaseObjectDescriptors;
DimModel: IDimensionModel;
DimInst: IDimInstance;
Selection: IDimSelection;
Group: IDimElementGroup;
Schema: IDimSelectionSchema;
RdsDict: IRdsDictionary;
LvlKey, AttrKey: UInteger;
DimComboBinding: IBindingDimCombo;
Begin
DimModel := Dimension.Bind() As IDimensionModel;
DimChildren := Dimension.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 := Dimension.Open(Null) As IDimInstance;
Selection := DimInst.CreateSelection();
Schema.ProcessInplace(Selection, Group);
DimComboBinding.ValueAttribute := "NAME";
DimComboBinding.ValueDefined := True;
DimComboBinding.Value := Selection.ToString("NAME", ",", False);
End If;
//Identifiers as the name of level elements 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;
//If the MDM dictionary is from the MDM repository, specify the RDS parameter
If Dimension.Bind() Is IRdsDictionary Then
RdsDict := Dimension.Bind() As IRdsDictionary;
If RdsDict.RdsDatabaseInstance <> Null Then
DimComboBinding.Rds := (RdsDict.RdsDatabaseInstance.Database As IMetabaseObject).Id;
End If;
End If;
//Multiple selection
DimComboBinding.SelectionMode := SelectionModeEnum.semodMultiSelect;
//Template for creating a name on multiple selection
DimComboBinding.CustomMultiselectText := "Range: %First-%Last";
Return DimComboBinding.AsString;
End Function;
See also: