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 destination 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 the number of available elements by dimensions in destination cube
Debug.WriteLine("Number of elements before selection application");
For Each Inst In Dest.Dimensions Do
Debug.WriteLine(Inst.Name + ": " + Inst.Elements.Count.ToString);
End For;
DimSS := Dest.CreateDimSelectionSet; //Selection of destination cube
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 to rebuild controlling dimension
Debug.WriteLine("Number of elements after selection application");
For Each Inst In Dest.Dimensions Do
Debug.WriteLine(Inst.Name + ": " + Inst.Elements.Count.ToString);
End For;
DimSS := App.ResultSelection;
//Select all obtained elements to load data
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: