ICubeSelectionControlApply.SourceSelection

Syntax

SourceSelection: IDimSelectionSet;

Description

The SourceSelection property determines the selection of controlling dimensions that is used to change selection in controlled dimensions.

Comments

To apply control parameters, use the ICalculatedCubeInstance.Apply method.

Example

Executing the example requires that the repository contains a cube with the STD_CUBE identifier. The cube contains a dimension with the Dim_1 identifier. This dimension is controlling one for other cube dimensions.

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

On executing the example the object that controls cube selection is created. One element will be selected in the controlling dimension. The source and output dimension lists will be displayed in the development environment console. The number of elements available for selection will be specified for each dimension.

See also:

ICubeSelectionControlApply