SaveToFile(FileName: String; CubeInstance: ICubeInstance): ICubeSerialInstance;
SaveToFile(FileName: String; CubeInstance: Prognoz.Platform.Interop.Cubes.ICubeInstance): Prognoz.Platform.Interop.Cubes.ICubeSerialInstance;
FileName. File that stores cube structure and cube data. If the file exists, it is automatically rewritten.
CubeInstance. Cube instance that must be saved to the file.
The SaveToFile method creates a file and initializes saving a cube to a file. Call the Save method after initialization to save data.
Executing the example requires that the repository contains a cube with the Cube_1 identifier.
Sub Main;
Var
MB: IMetabase;
Des: IMetabaseObjectDescriptor;
CubInst: ICubeInstance;
CubeDist: ICubeInstanceDestination;
CubS: ICubeSerializer;
CubSIns: ICubeSerialInstance;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
Begin
MB := MetabaseClass.Active;
CubS := New CubeSerializer.Create As ICubeSerializer;
Des := MB.ItemById("Cube_1");
CubInst := Des.Open(Null) As ICubeInstance;
CubeDist := CubInst.Destinations.DefaultDestination;
CubSIns := CubS.SaveToFile("c:\cub.ppcube", CubInst);
DimSS := CubeDist.CreateDimSelectionSet;
For Each DimS In DimSS Do
DimS.SelectAll;
End For;
CubSIns.Save(CubeDist, DimSS, 0);
End Sub Main;
After executing the example the cube with all data is saved to the cub.ppcube file.
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;
CubS: CubeSerializer = New CubeSerializerClass();
CubSIns: ICubeSerialInstance;
DimSS: IDimSelectionSet;
DimS: IDimSelection;
Begin
MB := Params.Metabase;
Des := MB.ItemById["Cube_1"];
CubInst := Des.Open(Null) As ICubeInstance;
CubeDist := CubInst.Destinations.DefaultDestination;
CubSIns := CubS.SaveToFile("c:\cub.ppcube", CubInst);
DimSS := CubeDist.CreateDimSelectionSet();
For Each DimS In DimSS Do
DimS.SelectAll();
End For;
CubSIns.Save(CubeDist, DimSS, 0);
End Sub;
See also: