ICubeSerializer.LoadFromFile

Fore Syntax

LoadFromFile(FileName: String; [Options: Integer = 0]): ICubeSerialInstance;

Fore.NET Syntax

LoadFromFile(FileName: String; Options: Integer): Prognoz.Platform.Interop.Cubes.CubeSerialInstance;

Parameters

FileName. Path and name of the file that is loaded from.

Options. Parameter is not used.

Description

The LoadFromFile method loads the cube saved to a file.

Fore Example

Executing the example requires a form, a button on it, the UiErAnalyzer component named UiErAnalyzer1, a file named c:\cub.ppcube that contains the saved cube and any components that display express report data.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    CubS: ICubeSerializer;
    CubSIns: ICubeSerialInstance;
    MatDs: IMatrixDataSource;
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
Begin
    MB := MetabaseClass.Active;
    CubS := New CubeSerializer.Create As ICubeSerializer;
    CubSIns := CubS.LoadFromFile("c:\cub.ppcube");
    MatDS := CubSIns.Destinations.Item(0As IMatrixDataSource;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Id := "Temp_Express";
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
    MObj := MB.CreateObject(CrInfo).Bind;
    UiErAnalyzer1.Active := True;
    UiErAnalyzer1.ErAnalyzer := MObj As IEaxAnalyzer;
    UiErAnalyzer1.ErAnalyzer.OpenCube(CubSerIns.Destinations.Item(0).Cube);
End Sub Button1OnClick;

After executing the example pressing the button loads the cube saved to the cub.ppcube file. A temporary express report is created for loading data to UiErAnalyzer1.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. instead of Fore components use their Fore.NET analogs.

Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    CubS: CubeSerializer = New CubeSerializerClass();
    CubSIns: ICubeSerialInstance;
    MatDs: IMatrixDataSource;
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
Begin
    MB := Self.Metabase;
    CubSIns := CubS.LoadFromFile("c:\cub.ppcube"0);
    MatDS := CubSIns.Destinations.Item[0As IMatrixDataSource;
    CrInfo := MB.CreateCreateInfo();
    CrInfo.Id := "Temp_Express";
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT As Integer;
    MObj := MB.CreateObject(CrInfo).Bind();
    UiErAnalyzer1.Active := True;
    UiErAnalyzer1.ErAnalyzer := MObj As IEaxAnalyzer;
    UiErAnalyzer1.ErAnalyzer.OpenCube(CubSerIns.Destinations.Item[0].Cube);
End Sub;

See also:

ICubeSerializer