DimensionBindings: ICubeLoaderDimensionBindings;
The DimensionBindings property returns parameters of dimension binding to data source fields.
When the Load method is executed, a separate dimension is created in the cube structure according to each binding.
Executing the example requires the following objects in repository:
Database with the BD identifier.
Table MDM dictionary with the COUNTRY identifier and the CALENDAR dictionary.
Folder with the F_CUBES identifier that stores cubes.
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(Null) As 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.
See also: