LoadCubes

Purpose

Opens a dialog box that is used to import data to a cube.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify the following value in this property:

Value type Description
IMetabaseObjectCreateInfo Description of repository object that corresponds to the created cube.

Application Features

Executing the command opens the dialog box for the file with data selection. The following file formats are available to select: XLS, XLSX, TXT, CSV. All the required tables and the standard cube are created after the file selection and executing all steps of data import to repository.

If the description of the created cube is not specified in the Data property, the dialog box with repository object selection, to which the cube is to be saved is displayed on the final step.

The created standard cube available for edit is the result of the Execute method execution.

Fore Example

Executing the example requires a form and a button named Button1 on the form. The repository contains a folder with the F_Cubes identifier, in which cubes are stored.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        MB: IMetabase;
        CrInfo: IMetabaseObjectCreateInfo;
        CommandTarget: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
    Begin
        MB := MetabaseClass.Active;
        CrInfo := MB.CreateCreateInfo;
        CrInfo.Permanent := True;
        CrInfo.Parent := MB.ItemById("F_Cubes");
        CrInfo.Id := "New_Cube";
        CrInfo.Name := Standard cube;
        CommandTarget := WinApplication.Instance.GetPluginTarget("Cubes");
        Context := CommandTarget.CreateExecutionContext;
        Context.Data := CrInfo;
        CommandTarget.Execute("LoadCubes", Context);
    End Sub Button1OnClick;

Clicking the button opens the dialog box for data import to a cube. After the file with data and cube import options are selected, the cube is saved to the specified folder with the specified identifier and name.

Fore.NET Example

Executing the example requires a form and a button named Button1 on the form. The repository contains a folder with the F_Cubes identifier, in which cubes are stored.

    Imports Prognoz.Platform.Forms.Net;
    Imports Prognoz.Platform.Interop.Metabase;
    Imports Prognoz.Platform.Interop.Ui;

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        MB: IMetabase;
        CrInfo: IMetabaseObjectCreateInfo;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
        WinAppCls: WinApplicationClassClass = New WinApplicationClassClass();
    Begin
        MB := Self.Metabase;
        CrInfo := MB.CreateCreateInfo();
        CrInfo.Permanent := True;
        CrInfo.Parent := MB.ItemById["F_Cubes"];
        CrInfo.Id := "New_Cube";
        CrInfo.Name := Standard cube;
        Target := WinAppCls.Instance[Null].GetPluginTarget("Cubes");
        Context := Target.CreateExecutionContext();
        Context.Data := CrInfo;
        Target.Execute("LoadCubes", Context, Null);
    End Sub;

Clicking the button opens the dialog box of data import to a cube. After the file with data and cube import options are selected, the cube is saved to the selected folder with the specified identifier and name.

See also:

IUiCommandTarget.Execute