ICubeLoaderInstance.ApplyDimensions

Syntax

ApplyDimensions(Apply: ICubeSelectionControlApply; [ApplySet: Boolean = True]): Boolean;

Parameters

Apply. Parameters of selection control that must be applied.

ApplySet. Parameter that determines method execution result. If True is passed as a parameter value and if selection is applied successfully, the output set of elements and selection of elements are updated in the destination cube. If False is passed as a parameter value, the method returns whether selection can be applied.

Description

The ApplyDimensions method applies control parameters of destination cube selection.

Comments

The method returns True if selection use with specified parameters was successful, and False if selection must not be used.

Example

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:

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

See also:

ICubeLoaderInstance