ICubeSerializer.SaveToFile

Syntax

SaveToFile(FileName: String; CubeInstance: ICubeInstance): ICubeSerialInstance;

Parameters

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.

Description

The SaveToFile method creates a file and initializes saving a cube to a file. Call the Save method after initialization to save data.

Example

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(NullAs 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.

See also:

ICubeSerializer