SelectionControl: ICubeSelectionControl;
SelectionControl: Prognoz.Platform.Interop.Cubes.ICubeSelectionControl;
The SelectionControl property returns the collection of controlling cube dimensions.
Controlling dimensions are used if parametric dimensions are added to cube. Setting up controlling dimensions allows for passing values of other dimensions' attributes as values of dimensions' parameters.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier, the cube structure has a dimension based on a dictionary with the INDICATORS identifier. The repository also has a parametric dictionary with the INDICATORS_INFO identifier, one integer parameter is created in the dictionary structure. Dictionary parameter values correspond with element key in the INDICATORS dictionary.
Add links to the Cubes, Dimensions, Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Cube: IStandardCube;
CubeDest: IStandardCubeDestination;
Dims: IStandardCubeDimensions;
SelControlItem: ICubeSelectionControlItem;
Begin
Mb := MetabaseClass.Active;
Cube := Mb.ItemById("STD_CUBE").Edit As IStandardCube;
CubeDest := Cube.Destinations.Item(0);
Dims := CubeDest.Dimensions;
//Add parametric dimension
Dims.Add(MB.ItemById("INDICATORS_INFO").Bind As IDimensionModel);
//Set up control
SelControlItem := CubeDest.SelectionControl.Item(0);
SelControlItem.ControllingDim := Dims.FindById("INDICATORS").Dimension;
SelControlItem.Expression.AsString := "FIRST.Key";
SelControlItem.SelectionStrategy := CubeSelectionControlStrategy.SelectFirst;
(Cube As IMetabaseObject).Save;
End Sub UserProc
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Cube: IStandardCube;
CubeDest: IStandardCubeDestination;
Dims: IStandardCubeDimensions;
SelControlItem: ICubeSelectionControlItem;
Begin
Mb := Params.Metabase;
Cube := Mb.ItemById["STD_CUBE"].Edit() As IStandardCube;
CubeDest := Cube.Destinations.Item[0];
Dims := CubeDest.Dimensions;
//Add parametric dimension
Dims.Add(MB.ItemById["INDICATORS_INFO"].Bind() As IDimensionModel);
//Set up control
SelControlItem := CubeDest.SelectionControl.Item[0];
SelControlItem.ControllingDim := Dims.FindById("INDICATORS").Dimension;
SelControlItem.Expression.AsString := "FIRST.Key";
SelControlItem.SelectionStrategy := CubeSelectionControlStrategy.cscsSelectFirst;
(Cube As IMetabaseObject).Save();
End Sub;
Executing the example adds a new dimension based on parametric dictionary to cube structure. Control is set up for the dimension: the key of the first element selected in the INDICATORS dimension is passed as a parameter value.
See also: