ApplyDimensions(Apply: ICubeSelectionControlApply; [ApplySet: Boolean = True]): Boolean;
Apply - selection control parameters that must be applied.
ApplySet - parameter that determines method performance result. If True is passed as a parameter value, after successful use of the selection the output set of dimension elements and elements selection are updated in the cube.
If False is passed as a parameter value, the method returns whether selection can be applied.
The ApplyDimensions method applies selection control parameters.
The method returns True if selection use with specified parameters was successful, and False if selection must not be used.
Executing the example requires that the repository contains a calculated cube with the Cube_1 identifier. A controlling dimension is set up in the cube. A controlling dimension is the dimension based on the Dim_1 dictionary.
Add links to the Metabase, Dimension and Cubes system assemblies.
Sub Main;
Var
MB: IMetabase;
CubeInst: ICalculatedCubeInstance;
Source: ICubeInstanceSource;
SelControl: ICubeSelectionControlApply;
DimSS: IDimSelectionSet;
Inst: IDimInstance;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("Cube_1").Open(Null) As ICalculatedCubeInstance;
Source := CubeInst.Sources.Item(0);
//Elements dimension, available before use selection
Debug.WriteLine("Before selection use");
For Each Inst In Source.Source.Dimensions Do
Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString);
End For;
//Create an empty selection
DimSS := Source.Source.CreateDimSelectionSet;
//Select the required element(s) in the controlling dimension
DimSS.FindById("Dim_1").SelectElement(0, False);
//Create an object to control selection dimension
SelControl := Source.CreateApplyDimensions;
//Indicate source selection
SelControl.SourceSelection := DimSS;
//Apply selection control parameters
Source.ApplyDimensions(SelControl, True);
//Output set of elements,
//which are available in dimensions after use of selection
Debug.WriteLine("After use of selection");
For Each Inst In Source.Source.Dimensions Do
Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString);
End For;
End Sub Main;
After executing the example selection control parameters for the first source cube are used. Elements, available by dimensions before and after the use of selection control parameters, are displayed in the development environment console.
See also: