Binding(Attribute: IDimAttribute): IExpression;
Attribute. Attribute of dimension index (dimension block), which is used to bind to data source fields.
The Binding property returns the expression that determines a link between cube data source fields and dimension attributes, by which the dimension index (dimension block) is created.
Executing the example requires a standard cube with the Stan_Cube identifier and a dictionary with the Dim_1 identifier. Add links to the Cubes, Db, Dimensions and Metabase system assemblies.
Sub Main;
Var
MB: IMetabase;
Dim: IDimensionModel;
StandCub: IStandardCube;
StDataset: IStandardCubeDataset;
Dataset: IDatasetModel;
Field: IDatasetModelField;
Block: IDimBlock;
Index: IDimIndex;
Attr: IDimAttribute;
StDim: IStandardCubeDimension;
StDimBind: IStandardCubeDimensionBinding;
Begin
MB := MetabaseClass.Active;
StandCub := MB.ItemById("Std_Cube").Edit As IStandardCube;
Dim := MB.ItemById("Dim_1").Bind As IDimensionModel;
StDataset := StandCub.Datasets.Item(0);
Dataset := StDataset.Dataset;
Field := Dataset.Fields.Item(0);
Block := Dim.Blocks.Item(0);
Index := Block.Indexes.PrimaryIndex;
Attr := Index.Attributes.Item(0);
StDim := StandCub.Dimensions.Add(Dim);
StDimBind := StDim.Binding(StDataset);
StDimBind.Index := Index;
StDimBind.Binding(Attr).AsString := (Dataset As IMetabaseObject).Id + "." + Field.Id;
(StandCub As IMetabaseObject).Save;
End Sub Main;
After executing the example the Dim_1 new dimension is added to the cube. Binding is executed by the primary index of the first dimension block. The first field of cube data source is mapped to the first attribute, by which index is created.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Dim: IDimensionModel;
StandCub: IStandardCube;
StDataset: IStandardCubeDataset;
Dataset: IDatasetModel;
Field: IDatasetModelField;
Block: IDimBlock;
Index: IDimIndex;
Attr: IDimAttribute;
StDim: IStandardCubeDimension;
StDimBind: IStandardCubeDimensionBinding;
Begin
MB := Params.Metabase;
StandCub := MB.ItemById["Std_Cube"].Edit() As IStandardCube;
Dim := MB.ItemById["Dim_1"].Bind() As IDimensionModel;
StDataset := StandCub.Datasets.Item[0];
Dataset := StDataset.Dataset;
Field := Dataset.Fields.Item[0];
Block := Dim.Blocks.Item[0];
Index := Block.Indexes.PrimaryIndex;
Attr := Index.Attributes.Item[0];
StDim := StandCub.Dimensions.Add(Dim);
StDimBind := StDim.Binding[StDataset];
StDimBind.Index := Index;
StDimBind.Binding[Attr].AsString := (Dataset As IMetabaseObject).Id + "." + Field.Id;
(StandCub As IMetabaseObject).Save();
End Sub;
See also: