ICubeLoaderInstance.CreateApplyDimensions

Syntax

CreateApplyDimensions: ICubeSelectionControlApply;

Description

The CreateApplyDimensions method creates an object that is used to control consumer cube dimensions selection.

Example

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:

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(
NullAs ICubeLoaderInstance;
    Dest := CLoad.Destination;
    
//Dimensions and the 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; 
//Selection of destination cube
    DimSS.FindById("Dim_1").SelectElement(0False); //Change element in controlling dimension
    App := CLoad.CreateApplyDimensions;
    App.SourceSelection := DimSS;
    
If CLoad.ApplyDimensions(App) Then // Apply selection to rebuild controlling 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 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 on 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 for available elements in the dimensions before and after applying the controlling dimension selection.

See also:

ICubeLoaderInstance