IMatrixDataSource.CreateDimSelectionSet

Syntax

CreateDimSelectionSet: IDimSelectionSet;

Description

The CreateDimSelectionSet method creates a set of selections for data source dimensions.

Example

Executing the example requires that the repository contains a cube with the CUBE identifier. A cube has not less than two dimensions, each of them has at least two elements. In the Facts dimension the first two elements are not calculated ones.

Add links to the Cube, Dimension, Matrix, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CubeInst: ICubeInstance;
    Destination: ICubeInstanceDestination;
    DimsInstance: ICubeInstanceDimensions;
    MatrDS: IMatrixDataSource;
    DimSS: IDimSelectionSet;
    Sel: IDimSelection;
    Matr: IMatrix;
    Coord: IMatrixCoord;
    i: Integer;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Open cube
    CubeInst := MB.ItemById("CUBE").Open(NullAs ICubeInstance;
    Destination := CubeInst.Destinations.DefaultDestination;
    MatrDS := Destination As IMatrixDataSource;
    // Get dimension data
    DimsInstance := Destination.Dimensions;
    // Create  set of selections
    DimSS := MatrDS.CreateDimSelectionSet;
    For i := 0 To DimSS.Count - 1 Do
        Sel := DimSS.Item(i);
        Sel.SelectElement(0False);
        Sel.SelectElement(1False);
    End For;
    // Calculate matrix
    Matr := MatrDS.Execute(DimSS);
    Coord := Matr.CreateCoord;
    For i := 0 To Matr.DimensionCount - 1 Do
        Coord.Item(i) := 0;
    End For;
    Matr.Item(Coord) := 101;
    // Save matrix to source
    MatrDS.SaveData(Matr);
End Sub UserProc;

After executing the example, a collection of selections for cube dimensions will be created. Selection will be set in the dimensions. After this, a data matrix will be obtained, and the value of the specified matrix element will be changed. Changes are saved back to the cube.

See also:

IMatrixDataSource