CreateStorage([Options: CubeInstanceStorageOptions = 0]): ICubeInstanceStorage;
Options - parameter that determines a mode of data storage in the cube.
The CreateStorage method creates an object that saves data to a cube.
Class CubeCallback: 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 CubeCallback;
Sub Main;
Var
MB: IMetabase;
CubInst: ICubeInstance;
Des: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Mat: IMatrix;
Coord: IMatrixCoord;
Sto: ICubeInstanceStorage;
i: Integer;
Begin
MB := MetabaseClass.Active;
CubInst := MB.ItemById("CUBE_1").Open(Null) As ICubeInstance;
Des := CubInst.Destinations.DefaultDestination;
Sels := Des.CreateDimSelectionSet;
For i := 0 To Sels.Count - 1 Do
Sels.Item(i).SelectElement(0, False);
End For;
Mat := Des.Execute(Sels);
Mat.ValueFlag := Mat.ValueFlag + 1;
Sels := Mat.Dimensions;
Coord := Mat.CreateCoord;
For i := 0 To Sels.Count - 1 Do
Coord.Item(i) := 0;
End For;
Mat.Item(Coord) := (Mat.Item(Coord) As Integer) + 1;
Sto := Des.CreateStorage(CubeInstanceStorageOptions.NoCheckDuplicates);
Sto.Callback := New CubeCallback.Create;
Sto.SaveMatrix(Mat, Mat.ValueFlag);
End Sub Main;
After executing the example a matrix with data from the cube with the CUBE_1 identifier is obtained. The value is changed by some coordinate, following which the updated matrix is saved back to the cube. During saving duplicates availability is not checked. Errors that may occur are handled in the CubeCallback custom class.
See also: