ICubeSerializer.LoadFromFile

Syntax

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

Parameters

FileName. Path and name of the file, from which loading is executed.

Options. Parameter is not used.

Description

The LoadFromFile method loads the cube saved to file.

Example

Executing the example requires that the repository contains the cub.ppcube file in the root of the C disk. The *.ppcube file is created during export of the express report containing the saved cube data view. Place on the form the components: Button, UiErAnalyzer named Button1 and UiErAnalyzer1, respectively.

Add links to the Cubes, Express, Forms, Matrix, and Metabase system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    CubS: ICubeSerializer;
    CubSIns: ICubeSerialInstance;
    MatDs: IMatrixDataSource;
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
Begin
    // Get the current repository
    MB := MetabaseClass.Active;
    // Create a cube loader from file
    CubS := New CubeSerializer.Create As ICubeSerializer;
    // Load cube from file
    CubSIns := CubS.LoadFromFile("c:\cub.ppcube");
    // Get the collection of cube display versions
    MatDS := CubSIns.Destinations.Item(0As IMatrixDataSource;
    // Create a temporary express report
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Id := "EXPRESS";
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
    MObj := MB.CreateObject(CrInfo).Bind;
    // Display express report
    UiErAnalyzer1.Active := True;
    UiErAnalyzer1.ErAnalyzer := MObj As IEaxAnalyzer;
    UiErAnalyzer1.ErAnalyzer.OpenMatrixDataSource(MatDS);
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.

See also:

ICubeSerializer