ICubeLoader.Source

Syntax

Source: ICubeModelDestination;

Description

The Source property determines a source cube for data load.

Example

Executing the example requires that the repository contains two cubes. The first cube is used as a data source, the second cube is used as a data consumer. The cubes have identifiers Cube_1 and Cube_2.

Sub Main;

Var

MB: IMetabase;

CrInf: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Cube: ICubeModel;

CubeDist: ICubeModelDestination;

CubLoad: ICubeLoader;

FixInfo: ICubeLoaderFixInfo;

DimFix: ICubeLoaderDimensionFix;

DimsSource: ICubeModelDimensions;

Dim, Dim1: IDimensionModel;

MapInfo: ICubeLoaderMapInfo;

MapItem: ICubeLoaderMapItem;

i: Integer;

Begin

MB := MetabaseClass.Active;

CrInf := Mb.CreateCreateInfo;

CrInf.ClassId := MetabaseObjectClass.KE_CLASS_CUBELOADER;

CrInf.Id := "Cube_Load";

CrInf.Name := "Cube_Load";

CrInf.Permanent := False;

MObj := Mb.CreateObject(CrInf).Edit;

CubLoad := MObj As ICubeLoader;

//source cube

Cube := MB.ItemById("Cube_1").Bind As ICubeModel;

CubeDist := Cube.Destinations.DefaultDestination;

CubLoad.Source := CubeDist;

//source cube dimensions, among which consumer cube dimensions for connection are searched

DimsSource := CubeDist.Dimensions;

//consumer cube

Cube := MB.ItemById("Cube_2").Bind As ICubeModel;

CubeDist := Cube.Destinations.DefaultDestination;

CubLoad.Destination := CubeDist;

//binding of dimensions

MapInfo := CubLoad.MapInfo;

For i := 0 To MapInfo.Count - 1 Do

MapItem := MapInfo.Item(i);

Dim := MapItem.Dimension;

Dim1 := DimsSource.FindById((Dim As IMetabaseObject).Id);

If Dim1 <> Null Then

MapItem.MapDimension := Dim1;

MapItem.MapIndex := Dim1.Indexes.PrimaryIndex;

MapItem.DimIndex := Dim.Indexes.PrimaryIndex;

MapItem.Method := CubeLoaderMapMethod.ByIndex;

End If;

End For;

//fixing of dimensions

FixInfo := CubLoad.FixInfo;

For Each DimFix In CubLoad.FixInfo Do

DimFix.Operation := BasicAggregatorOperation.ActualMean;

DimFix.Selection.SelectAll;

End For;

MObj.Save;

End Sub Main;

After executing the example the Cube Loader object is created in the repository root. The cube with the Cube_1 identifier is used as a source cube, the cube with the Cube_2 identifier is used as a consumer cube. Equal dimensions, present in each cube, are bound by index. Dimensions, present in the source cube, but absent in the consumer cube, are fixed.

See also:

ICubeLoader