ICubeInstanceDestination.ApplyDimensions

Syntax

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

Parameters

Apply - selection control parameters that must be used.

ApplySet - parameter that determines method execution result. If True is passed as a parameter value, after successful use of the selection the output set of dimension elements and elements selection are updated in the cube.

If False is passed as a parameter value, the method indicates whether selection can be applied.

Description

The ApplyDimensions method applies selection control parameters.

Comments

The method returns True if selection use with specified parameters was successful, and False if selection use is unacceptable.

Example

Executing the example requires that the repository contains a cube with the Cube_1 identifier. A controlling dimension is set up in the cube. The controlling dimension is the dimension based on the Dim_1 dictionary.

Sub UserProc;
Var
    MB: IMetabase;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    SelControl: ICubeSelectionControlApply;
    DimSS: IDimSelectionSet;
    Inst: IDimInstance;
Begin
    MB := MetabaseClass.Active;
    CubeInst := MB.ItemById("Cube_1").Open(NullAs ICubeInstance;
    Dest := CubeInst.Destinations.DefaultDestination;
    //Dimension elements available before selection use
    Debug.WriteLine("Before selection use");
    For Each Inst In Dest.Dimensions Do
        Debug.WriteLine("Dimension:  + Inst.Name + "; Available elements:  + Inst.Elements.Count.ToString);
    End For;
    //Create an empty selection
    DimSS := Dest.CreateDimSelectionSet;
    //Selection of required element(s) in controlling dimension
    DimSS.FindById("Dim_1").SelectElement(0False);
    //Create an object to control selection dimension
    SelControl := Dest.CreateApplyDimensions(SelectionControlApplyMode.Apply);
    //Indicate source selection
    SelControl.SourceSelection := DimSS;
    //Use selection control parameters
    Dest.ApplyDimensions(SelControl, True);
    //Output set of elements,
    //which are available in dimensions after use of selection
    Debug.WriteLine("After use of selection");
    For Each Inst In Dest.Dimensions Do
        Debug.WriteLine(Dimension:  + Inst.Name + ; Available elements:  + Inst.Elements.Count.ToString);
    End For;
End Sub UserProc;

After executing the example selection control parameters for the cube are used. Elements, available by dimensions before and after the use of selection control parameters, are displayed in the development environment console.

See also:

ICubeInstanceDestination