ICubeInstanceSource.ApplyDimensions

Fore Syntax

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

Fore.NET Syntax

ApplyDimensions(Apply: Prognoz.Platform.Interop.Cubes.ICubeSelectionControlApply; [ApplySet: Boolean = True]): Boolean;

Parameters

Apply - selection control parameters that must be applied.

ApplySet - parameter that determines method performance 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 returns 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 must not be used.

Fore Example

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

Add links to the Metabase, Dimension and Cubes system assemblies.

Sub Main;
Var
    MB: IMetabase;
    CubeInst: ICalculatedCubeInstance;
    Source: ICubeInstanceSource;
    SelControl: ICubeSelectionControlApply;
    DimSS: IDimSelectionSet;
    Inst: IDimInstance;
Begin
    MB := MetabaseClass.Active;
    CubeInst := MB.ItemById("Cube_1").Open(NullAs ICalculatedCubeInstance;
    Source := CubeInst.Sources.Item(0);
    //Elements dimension, available before use selection
    Debug.WriteLine("Before selection use");
    For Each Inst In Source.Source.Dimensions Do
        Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString);
    End For;
    //Create an empty selection
    DimSS := Source.Source.CreateDimSelectionSet;
    //Select the required element(s) in the controlling dimension
    DimSS.FindById("Dim_1").SelectElement(0False);
    //Create an object to control selection dimension
    SelControl := Source.CreateApplyDimensions;
    //Indicate source selection
    SelControl.SourceSelection := DimSS;
    //Apply selection control parameters
    Source.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 Source.Source.Dimensions Do
        Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString);
    End For;
End Sub Main;

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

Fore.NET Example

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

Add links to the Metabase, Dimension and Cubes system assemblies.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Cubes;
...
Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CubeInst: ICalculatedCubeInstance;
    Source: ICubeInstanceSource;
    SelControl: ICubeSelectionControlApply;
    DimSS: IDimSelectionSet;
    Inst: IDimInstance;
Begin
    MB := Params.Metabase;
    CubeInst := MB.ItemById["Cube_1"].Open(NullAs ICalculatedCubeInstance;
    Source := CubeInst.Sources.Item[0];
    //Elements dimension, available before use selection
    System.Diagnostics.Debug.WriteLine("Before applying selection");
    For Each Inst In Source.Source.Dimensions Do
        System.Diagnostics.Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString());
    End For;
    //Create an empty selection
    DimSS := Source.Source.CreateDimSelectionSet();
    //Select the required element in the controlling dimension
    DimSS.FindById("Dim_1").SelectElement(0False);
    //Create an object to control selection dimension
    SelControl := Source.CreateApplyDimensions();
    //Indicate source selection
    SelControl.SourceSelection := DimSS;
    //Apply selection control parameters
    Source.ApplyDimensions(SelControl, True);
    //Output set of elements,
    //which are available in dimensions after use of selection
    System.Diagnostics.Debug.WriteLine("After applying selection");
    For Each Inst In Source.Source.Dimensions Do
        System.Diagnostics.Debug.WriteLine("Dimension: " + Inst.Name + "; Elements available: " + Inst.Elements.Count.ToString());
    End For;
End Sub;

After executing the example selection control parameters for the first source 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:

ICubeInstanceSource