ICubeModelAlternateSource.AddDimension

Syntax

AddDimension(Value: IDimensionModel);

Parameters

Value - alternative cube dimension that must be added to the list.

Description

The AddDimension property adds an alternative cube dimension to the collection of dimensions. The data will be selected based on the elements of these dimensions.

Comments

Dimensions are absent in the list by default. Data loading is determined by alternative cube settings. If the UseExecute property is set to True, all data is loaded from the alternative cube, otherwise data is loaded from the source cube data source.

If any dimensions are added to the list, on opening the source cube the alternative cube is checked added point by added point if it contains data. If any points of one dimension contains data, data is loaded from the alternative cube by all coordinates, to which this point is included. The loading from the source cube data source is made by all points, for which data in the alternative cube is absent.

NOTE. This mechanism is supported only for standard cubes.

Example

Executing the example requires that the repository contains two standard cubes:

Both cubes are based on the same set of dictionaries. A calendar dimension is present in each cube.

Sub Main;

Var

MB: IMetabase;

Cube: ICubeModel;

AltCube: ICubeModelAlternateSource;

Dims: ICubeModelDimensions;

Dim: IDimensionModel;

i: Integer;

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;

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

Dim := Dims.Item(i);

If (Dim Is ICalendarDimension) Then

AltCube.AddDimension(Dim);

Break;

End If;

End For;

(Cube As IMetabaseObject).Save;

End Sub Main;

After executing the example the Cube_1 cube is set for using the alternative cube. In the alternative cube the calendar dimension is included to the dimensions list, by which coordinates the search of the extracted data is executed.

When the Cube_1 cube is opened, the data of any date of the calendar dimension is loaded from the alternative cube. Data for the dates of the calendar dimension that is absent in the alternative cube is loaded from the data source of the Cube_1 data.

See also:

ICubeModelAlternateSource

ICubeModelAlternateSource.RemoveDimension