ICubeInstanceStorage.CreateMatrix

Syntax

CreateMatrix(

Dimensions: IDimSelectionSet;

Options: Integer;

ExecuteSet: IDimSelectionSet): IMatrix;

CreateMatrix(

Dimensions: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet;

Options: Integer;

ExecuteSet: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet): Prognoz.Platform.Interop.Matrix.IMatrix;

Parameters

Dimensions. Selection, according to which a cube matrix is created.

Options. The parameter is reserved for internal use. Send 0 as a value.

ExecuteSet. The parameter is reserved for the future.

Description

The CreateMatrix method creates an empty matrix that can be further filled with data and saved to cube.

Comments

The method enables the use to create an empty matrix without actual cube building. Matrix structure will correspond with the selection specified in the Dimensions parameter. If empty selection is sent in the Dimensions parameter, the matrix will correspond with the maximum cube selection.

In the current implementation, send Null or the selection specified in Dimensions as a value of the ExecuteSet parameter.

Example

Executing the example requires that the repository contains a cube with the STD_CUBE identifier.

Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CubInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
    Matr: IMatrix;
    Coord: IMatrixCoord;
    Sto: ICubeInstanceStorage;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    CubInst := MB.ItemById(
"STD_CUBE").Open(NullAs ICubeInstance;
    Dest := CubInst.Destinations.DefaultDestination;
    Sels := Dest.CreateDimSelectionSet;
    
For Each Sel In Sels Do
        Sel.SelectElement(
0False);
    
End For;
    
//Get values matrix by specified selection
    Sto := Dest.CreateStorage(CubeInstanceStorageOptions.None);
    Matr := Sto.CreateMatrix(Sels, 
0Null);
    Matr.ValueFlag := Matr.ValueFlag + 
1;
    
//Create a coordinate in matrix
    Coord := Matr.CreateCoord;
    
For i := 0 To Matr.DimensionCount - 1 Do
        Coord.Item(i) := 
0;
    
End For;
    
//Change value by coordinate
    Matr.Item(Coord) := 100;
    //Save value
    Sto.SaveMatrix(Matr, Matr.ValueFlag);
End Sub UserProc;

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CubInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
    Matr: IMatrix;
    Coord: IMatrixCoord;
    Sto: ICubeInstanceStorage;
    i: Integer;
Begin
    MB := Params.Metabase;
    CubInst := MB.ItemById[
"STD_CUBE"].Open(NullAs ICubeInstance;
    Dest := CubInst.Destinations.DefaultDestination;
    Sels := Dest.CreateDimSelectionSet();
    
For Each Sel In Sels Do
        Sel.SelectElement(
0False);
    
End For;
    
//Get values matrix by specified selection
    Sto := Dest.CreateStorage(CubeInstanceStorageOptions.cisoNone);
    Matr := Sto.CreateMatrix(Sels, 
0Null);
    Matr.ValueFlag := Matr.ValueFlag + 
1;
    
//Create a coordinate in matrix
    Coord := Matr.CreateCoord();
    
For i := 0 To Matr.DimensionCount - 1 Do
        Coord.Item[i] := 
0;
    
End For;
    
//Change value by coordinate
    Matr.Item[Coord] := 100;
    
//Save value
    Sto.SaveMatrix(Matr, Matr.ValueFlag);
End Sub;

After executing the example an empty matrix is created by the specified cube selection. The value is written to the matrix. After this the matrix is saved to cube.

See also:

ICubeInstanceStorage