Using Alternative Data Source in Standard Cube

Standard cube supports the use of alternative data source. Data can be stored and loaded in alternative source, or filtering can be used by any dimension.

Consider the mechanism of functioning in the following example.

Executing the example requires that the repository contains a standard cube with the Cube_1 identifier. The cube contains three dimensions. Dimensions are based on the following dictionaries:

The data source of the Cube_1 cube contains the following data:

The repository also contains the Cube_2 standard cube. Cube structure is similar to structure of the Cube_1 cube. Cube_2 is used as an alternative data source for Cube_1.

The data source of the Cube_2 cube contains the following data:

Execute the following code to connect and set up the alternative cube:

Sub Main;

Var

MB: IMetabase;

Cube: ICubeModel;

AltCube: ICubeModelAlternateSource;

Dims: ICubeModelDimensions;

Dim: IDimensionModel;

Begin

MB := MetabaseClass.Active;

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

AltCube := Cube.Destinations.DefaultDestination.AlternateSource;

AltCube.Source := (MB.ItemById("Cube_2").Bind As ICubeModel).Destinations.DefaultDestination;

AltCube.AutoSaveToStorage := False;

AltCube.UseExecute := True;

AltCube.UseStorage := True;

Dims := AltCube.Destination.Dimensions;

Dim := Dims.FindById(CALENDAR); //Calendar

AltCube.AddDimension(Dim);

(Cube As IMetabaseObject).Save;

End Sub Main;

After executing the code the Cube_2 alternative cube is connected to the Cube_1 cube. A calendar dimension is added to the list of dimensions, by coordinates of which data is loaded from the alternative cube. Data by all calendar points is searched and loaded into the alternative cube on opening the Cube_1 cube. By those calendar points, by which data is missing in the alternative cube, data is loaded from own source of the Cube_1 cube.

Execute the following code:

Sub Main;

Var

MB: IMetabase;

Cube: ICubeModel;

AltCube: ICubeModelAlternateSource;

Dims: ICubeModelDimensions;

Dim: IDimensionModel;

Begin

MB := MetabaseClass.Active;

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

AltCube := Cube.Destinations.DefaultDestination.AlternateSource;

AltCube.Source := (MB.ItemById("Cube_2").Bind As ICubeModel).Destinations.DefaultDestination;

AltCube.AutoSaveToStorage := False;

AltCube.UseExecute := True;

AltCube.UseStorage := True;

Dims := AltCube.Destination.Dimensions;

Dim := Dims.FindById(CALENDAR); //Calendar

AltCube.AddDimension(Dim);

Dim := Dims.FindById(DIM_1); //The first

AltCube.AddDimension(Dim);

(Cube As IMetabaseObject).Save;

End Sub Main;

After executing the code two dimensions: calendar dimension and dimension with factors are added to the list of alternative cube dimensions, by coordinates of which data is loaded. On opening the cube_1 cube, data on any calendar point is searched and loaded to the alternative cube. Then data on any point of dimension with factors is searched. All other values are loaded from own source of the Cube_1 cube:

See also:

Examples