ICubeLoader.Destination

Syntax

Destination: ICubeModelDestination;

Description

The Destination property determines a destination 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 UserProc;
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;
    // Create a data loader
    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, in which data consumer dimensions will be searched for linking
    DimsSource := CubeDist.Dimensions;
    // Destination cube
    Cube := MB.ItemById("Cube_2").Bind As ICubeModel;
    CubeDist := Cube.Destinations.DefaultDestination;
    CubLoad.Destination := CubeDist;
    // Dimension binding
    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;
    // Dimension fixing
    FixInfo := CubLoad.FixInfo;
    For Each DimFix In CubLoad.FixInfo Do
        DimFix.Operation := BasicAggregatorOperation.ActualMean;
        DimFix.Selection.SelectAll;
    End For;
    MObj.Save;
End Sub UserProc;

After executing the example the Data 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 destination cube. Equal dimensions, present in each cube, are bound by index. The dimensions, present in the source cube, but absent in the destination cube, are fixed.

See also:

ICubeLoader