ApplyDimensions(Apply: ICubeSelectionControlApply; [ApplySet: Boolean = True]): Boolean;
Apply. Parameters of selection control that must be applied.
ApplySet. Parameter that determines method execution result. If True is passed as a parameter value, if selection is applied successfully, the output set of elements and selection of elements are updated in the consumer cube. If False is passed as a parameter value, the method returns whether selection can be applied.
The ApplyDimensions method applies control parameters of consumer cube selection.
The method returns True if selection use with specified parameters was successful, and False if selection must not be used.
Executing the example requires a data loader with the CUBE_LOAD identifier set for passing data from source cube to consumer cube. There consumer cube contains three dimensions:
Fact dimension.
Dimension based on dictionary with the Dim_1 identifier.
Dimension based on dictionary with the Dim_2 identifier.
The dimension based on a dictionary with the Dim_1 identifier is a controlling one for the dimension based on a dictionary with the Dim_2 identifier.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
CLoad: ICubeLoaderInstance;
Dest: ICubeInstanceDestination;
Inst: IDimInstance;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
App: ICubeSelectionControlApply;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("CUBE_LOAD").Bind;
CLoad := MObj.Open(Null) As ICubeLoaderInstance;
Dest := CLoad.Destination;
//Dimensions and number of available elements by dimensions in consumer cube
Debug.WriteLine("Number of elements before selection is applied");
For Each Inst In Dest.Dimensions Do
Debug.WriteLine(Inst.Name + ": " + Inst.Elements.Count.ToString);
End For;
DimSS := Dest.CreateDimSelectionSet; //Consumer cube selection
DimSS.FindById(Dim_1).SelectElement(0, False); //Change element in controlling dimension
App := CLoad.CreateApplyDimensions;
App.SourceSelection := DimSS;
If CLoad.ApplyDimensions(App) Then //Apply selection for rearrangement of controlled dimension
Debug.WriteLine("Number of elements after selection has been applied");
For Each Inst In Dest.Dimensions Do
Debug.WriteLine(Inst.Name + ": " + Inst.Elements.Count.ToString);
End For;
DimSS := App.ResultSelection;
//Select all obtained elements for data loading
For Each DimS In DimSS Do
DimS.SelectAll;
End For;
CLoad.Execute(DimSS);
End If;
End Sub Main;
After executing the example data is loaded to the cube. To load data, a loader is opened in the cube, selection is set up in the controlling dimension of the Dim_1 consumer cube, and selection is applied to get data for the Dim_2 controlled dimension. If selection application completed successfully, data is loaded by all output selection of consumer cube. The development environment console displays data on available elements in the dimensions before and after applying the controlling dimension selection.
See also: