ICubeLoaderFromSource.Load

Syntax

Load(Source: Object; CreateInfo: IMetabaseObjectCreateInfo): IMetabaseObject;

Properties

Source. The data source described by the  IDtProvider interface.

CreateInfo. Information about created cube. If information is missing or loading to the current cube is executed, the Null value must be passed as a parameter.

Description

The Load method executes data loading.

Comments

A new cube is created before loading. A cube is based on the information passed by the CreateInfo parameter. If parameter is not specified, the information about the cube is generated automatically, and the cube is saved to the folder specified in the Parent property.

A table is created in the repository according to the information about bindings that must be set for dimensions and facts. The data will be further loaded to this table. The cube structure is formed, bindings among dimensions, facts and tables are determined, and the cube is saved after creating the table.

Data is loaded from the source to the table as follows:

Example

Executing the example requires that the repository contains an MDM repository with the MDM identifier and a folder with the F_CUBES identifier, which stores cubes. Also, the C:\Data.xls file is required.

Sub UserProc;
Var
    MB: IMetabase;
    Loader: ICubeLoaderFromSource;
    Provider: IDtExcelProvider;
    MDM: IRdsDatabaseInstance;
    Bindings: ICubeLoaderDimensionBindings;
    Binding: ICubeLoaderDimensionBinding;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    MDM := MB.ItemById("MDM").Open(NullAs IRdsDatabaseInstance;
    //Data source for cube
    Provider := New DtExcelProvider.Create;
    Provider.DriverVersion := "Excel 8.0";
    Provider.File := "C:\Data.xls";
    Provider.HasHeader := True;
    Provider.Query := "Select * From [Sheet1$]";
    //Cube data loader 
    Loader := New CubeLoaderFromSource.Create;
    Loader.CreateCacheKeeper := True;
    Loader.RdsDatabase := MDM;
    Loader.Database := MDM.DatabaseInstance;
    Loader.Parent := MB.ItemById("F_CUBES").Bind;
    //Initialize dimensions and facts bindings
    Loader.Init(Provider);
    //Change dictionary level bound to calendar dimension
    Bindings := Loader.DimensionBindings;
    For i := 0 To Bindings.Count - 1 Do
        Binding := Bindings.Item(i);
        If Binding.IsCalendar Then
            Binding.CalendarLevel := DimCalendarLevel.Year;
        End If;
    End For;
    //Cube creation and data loading
    Loader.Load(Provider, Null);
End Sub UserProc;

On executing the example the import object from Excel and the cube data loader are initialized. The dimensions bindings and facts of created cube are set up according to the information about data source fields. A new standard cube, necessary dictionaries and dimensions, and the table to store data are created on executing the Load method. The data is imported to the created table.

See also:

ICubeLoaderFromSource