ICubeSerialInstance.Save

Fore Syntax

Save(

Destination: ICubeInstanceDestination;

Selection: IDimSelectionSet;

[Options: Integer = 0]): ICubeInstanceDestination;

Fore.NET Syntax

Save(

Destination: Prognoz.Platform.Interop.Cubes.ICubeInstanceDestination;

Selection: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet;

Options: Integer): Prognoz.Platform.Interop.Cubes.ICubeInstanceDestination;

Parameters

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.

Description

The Save method saves a cube data to a file.

Comments

The Options parameter can take the following values:

Fore Example

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(NullAs ICubeInstance;
    CubeDist := CubInst.Destinations.DefaultDestination;
    CubSerIns := CubSer.SaveToFile("c:\cub.ppcube", CubInst);
    DimSS := CubeDist.CreateDimSelectionSet;
    For Each DimS In DimSS Do
        DimS.SelectElement(0False);
    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.

Fore.NET Example

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(NullAs ICubeInstance;
    CubeDist := CubInst.Destinations.DefaultDestination;
    CubSerIns := CubSer.SaveToFile("c:\cub.ppcube", CubInst);
    DimSS := CubeDist.CreateDimSelectionSet();
    For Each DimS In DimSS Do
        DimS.SelectElement(0False);
    End For;
    CubSerIns.Save(CubeDist, DimSS, 1);
End Sub;

See also:

ICubeSerialInstance