Save(
Destination: ICubeInstanceDestination;
Selection: IDimSelectionSet;
[Options: Integer = 0]): ICubeInstanceDestination;
Save(
Destination: Prognoz.Platform.Interop.Cubes.ICubeInstanceDestination;
Selection: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet;
Options: Integer): Prognoz.Platform.Interop.Cubes.ICubeInstanceDestination;
Destination. The cube display version, according to which saved data is calculated.
Selection. Cube selection, according to which the saved data is calculated.
Options. Parameter, available from the kernel, saves either all values in the dimension or selected values only, depending on the value.
The Save method saves a cube data to a file.
The Options parameter can take the following values:
0. All elements are saved in dimensions.
1. Only selected elements are saved in dimensions.
Executing the example requires that the repository contains a cube with the Cube_1 identifier.
Sub UserProc;
Var
MB: IMetabase;
Des: IMetabaseObjectDescriptor;
CubInst: ICubeInstance;
CubeDist: ICubeInstanceDestination;
CubSer: ICubeSerializer;
CubSerIns: ICubeSerialInstance;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
Begin
MB := MetabaseClass.Active;
CubSer := New CubeSerializer.Create As ICubeSerializer;
CubSer.StorageType := CubeSerialStorageType.SingleFile;
CubSer.FileName := "cub";
Des := MB.ItemById("CUBE_1");
CubInst := Des.Open(Null) As ICubeInstance;
CubeDist := CubInst.Destinations.DefaultDestination;
CubSerIns := CubSer.SaveToFile("c:\cub.ppcube", CubInst);
DimSS := CubeDist.CreateDimSelectionSet;
For Each DimS In DimSS Do
DimS.SelectElement(0, False);
End For;
CubSerIns.Save(CubeDist, DimSS, 1);
End Sub UserProc;
After executing the example the cube with data contained only in the selected elements will be saved to the cub.ppcube file. The structure of dimensions also saves only selected elements.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Sub Main(Params: StartParams);
Var
MB: IMetabase;
Des: IMetabaseObjectDescriptor;
CubInst: ICubeInstance;
CubeDist: ICubeInstanceDestination;
CubSer: CubeSerializer = New CubeSerializerClass();
CubSerIns: ICubeSerialInstance;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
Begin
MB := Params.Metabase;
CubSer.StorageType := CubeSerialStorageType.cubserstotypSingleFile;
CubSer.FileName := "cub";
Des := MB.ItemById["CUBE_1"];
CubInst := Des.Open(Null) As ICubeInstance;
CubeDist := CubInst.Destinations.DefaultDestination;
CubSerIns := CubSer.SaveToFile("c:\cub.ppcube", CubInst);
DimSS := CubeDist.CreateDimSelectionSet();
For Each DimS In DimSS Do
DimS.SelectElement(0, False);
End For;
CubSerIns.Save(CubeDist, DimSS, 1);
End Sub;
See also: