ICubeLoaderFromSource.DimensionBindings

Fore Syntax

DimensionBindings: ICubeLoaderDimensionBindings;

Fore.NET Syntax

DimensionBindings: ICubeLoaderDimensionBindings;

Description

The DimensionBindings property returns parameters of dimension binding to data source fields.

Comments

When the Load method is executed, a separate dimension is created in the cube structure according to each binding.

Fore Example

Executing the example requires the following objects in repository:

Also, the C:\Data.xls file is required.

Sub UserProc;
Var
    MB: IMetabase;
    Loader: ICubeLoaderFromSource;
    Provider: IDtExcelProvider;
    DimBindings: ICubeLoaderDimensionBindings;
    DimBinding: ICubeLoaderDimensionBinding;
Begin
    MB := MetabaseClass.Active;
    //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.Database := MB.ItemById("BD").Open(NullAs IDatabaseInstance;
    Loader.Parent := MB.ItemById("F_CUBES").Bind;
    //Binding parameters for dimensions and facts
    DimBindings := Loader.DimensionBindings;
    DimBinding := DimBindings.Add("COUNTRY");
    DimBinding.Dictionary := MB.ItemById("COUNTRY").Bind As IDimensionModel;
    DimBinding := DimBindings.AddCalendar("DATE", DimCalendarLevel.Month);
    DimBinding.Dictionary := MB.ItemById("CALENDAR").Bind As IDimensionModel;
    Loader.FactBindings.Add("VALUE");
    //Cube creation and data loading
    Loader.Load(Provider, Null);
End Sub UserProc;

The import object from Excel and the cube data loader are initialized on executing the example. The binding parameters of dimensions and facts are prepared for cube creation. Dimensions and facts are bound to the specified fields, and the current repository dictionaries are used as dimensions. When the Load method is executed, a new standard cube and a table to store data are created. The data must be imported to the created table.

Fore.NET Example

Executing the example requires the following objects in the repository:

Also, the C:\Data.xls file is required. The specified procedure is an entry point for the .NET assembly.

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Loader: ICubeLoaderFromSource;
    Provider: IDtExcelProvider;
    DimBindings: ICubeLoaderDimensionBindings;
    DimBinding: ICubeLoaderDimensionBinding;
Begin
    MB := Params.Metabase;
    //Data source for the cube
    Provider := New DtExcelProviderClass();
    Provider.DriverVersion := "Excel 8.0";
    Provider.File := "C:\Data.xls";
    Provider.HasHeader := True;
    Provider.Query := "Select * From [Sheet1$]";
    //Data loader in the cube
    Loader := New CubeLoaderFromSourceClass();
    Loader.Database := MB.ItemById["BD"].Open(NullAs IDatabaseInstance;
    Loader.Parent := MB.ItemById["F_CUBES"].Bind();
    //Binding options for dimensions and facts
    DimBindings := Loader.DimensionBindings;
    DimBinding := DimBindings.Add("COUNTRY");
    DimBinding.Dictionary := MB.ItemById["COUNTRY"].Bind() As IDimensionModel;
    DimBinding := DimBindings.AddCalendar("DATE", DimCalendarLevel.dclMonth);
    DimBinding.Dictionary := MB.ItemById["CALENDAR"].Bind() As IDimensionModel;
    Loader.FactBindings.Add("VALUE");
    //Cube creation and data loading
    Loader.Load(Provider, Null);
End Sub Main;

The import object from Excel and the cube data loader are initialized on executing the example. The binding parameters of dimensions and facts are prepared for cube creation. Dimensions and facts are bound to the selected fields, and the current repository dictionaries are used as dimensions. When the Load method is executed, a new standard cube and a table to store data are created. The data is imported to the created table.

See also:

ICubeLoaderFromSource