CreateStorage([Options: CubeInstanceStorageOptions = 0]): ICubeInstanceStorage;
Options. The parameter that determines a cube data saving mode.
The CreateStorage method creates an object that saves data to a cube.
Executing the example requires that the repository contains a cube with the CUBE_1 identifier.
Add links to the Cubes, Dimensions, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Matr: IMatrix;
Coord: IMatrixCoord;
Sto: ICubeInstanceStorage;
i: Integer;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("CUBE_1").Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
For i := 0 To Sels.Count - 1 Do
Sels.Item(i).SelectElement(0, False);
End For;
Matr := Dest.Execute(Sels);
Matr.ValueFlag := Matr.ValueFlag + 1;
Sels := Matr.Dimensions;
Coord := Matr.CreateCoord;
For i := 0 To Sels.Count - 1 Do
Coord.Item(i) := 0;
End For;
Matr.Item(Coord) := (Matr.Item(Coord) As Integer) + 1;
Sto := Dest.CreateStorage(CubeInstanceStorageOptions.NoCheckDuplicates);
Sto.Callback := New CubeCallback.Create;
Sto.SaveMatrix(Matr, Matr.ValueFlag);
End Sub UserProc;
Class TCubeCallback: Object, ICubeCallback
Public Sub OnCallback(Argument: ICubeCallbackArgument);
Begin
Debug.WriteLine("Error: " + Argument.Error.Message);
Debug.WriteLine("Error identifier: " + Argument.Error.MessageID.ToString);
Debug.WriteLine("Source: " + Argument.Error.Source);
Argument.IgnoreError := True;
End Sub OnCallback;
Public Function get_Argument: ICubeCallbackArgument;
Begin
Return Null;
End Function get_Argument;
End Class TCubeCallback;
After executing the example a matrix with cube data is obtained. The value is changed by some coordinate, after which the updated matrix is saved back to the cube. Duplicates availability is not checked during saving. The errors that may occur are handled in the TCubeCallback custom class.
See also: