CreateApplyDimensions: ICubeSelectionControlApply;
The CreateApplyDimensions method creates an object that is used to control destination cube dimensions selection.
Executing the example requires a data loader with the CUBE_LOAD identifier set for passing data from source cube to destination cube. There destination cube contains three dimensions:
Fact dimension.
Dimension based on a 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 UserProc;
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 destination cube
For Each Inst In Dest.Dimensions Do
Debug.WriteLine(Inst.Name + ": " + Inst.Elements.Count.ToString);
End For;
DimSS := Dest.CreateDimSelectionSet; //Destination 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 to rebuild controlled dimension
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 UserProc;
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 destination cube, and selection is applied to get data for the Dim_2 controlled dimension. If the selection was applied successfully, data is loaded by all output selection of destination cube. The development environment console displays data for available elements in the dimensions before and after applying the controlling dimension selection.
See also: