IBasicMatrixLevelAggregator.PreserveMethod

Syntax

PreserveMethod: ExistingDataPreserveMethod;

Description

The PreserveMethod property determines a method for saving non-aggregated data.

Example

Executing the example requires that the repository contains a cube with the Cube_1 identifier. The cube includes the D_TO dimension that contains more than two levels.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

StandCub: IStandardCube;

Man: IMatrixAggregatorManager;

Dim: IStandardCubeDimension;

Lvl: IDimLevels;

BasicAggr: IBasicMatrixAggregator;

LevAggr: IBasicMatrixLevelAggregator;

Dest: IStandardCubeDestination;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("CUBE_1").Edit;

StandCub := MObj As IStandardCube;

//Create a new aggregator

Man := New MatrixAggregatorManager.Create As IMatrixAggregatorManager;

//Basic aggregation mechanism

BasicAggr := Man.CreateAggregator("BasicMatrixAggregator") As IBasicMatrixAggregator;

//For dimension D_TO

Dim := StandCub.Dimensions.FindById("D_TO");

Lvl := Dim.Dimension.Levels;

BasicAggr.Dimension := Dim.Dimension;

//For default level

LevAggr := BasicAggr.DefaultLevelAggregation;

LevAggr.Operation := BasicAggregatorOperation.ArithmeticalMean;

LevAggr.PreserveExistingData := True;

LevAggr.PreserveMethod := ExistingDataPreserveMethod.OnNull;

//For the second level

//Destination level

LevAggr := BasicAggr.LevelAggregation(Lvl.Item(Lvl.Count - 2));

LevAggr.UseDefaultLevelAggregation := False;

//Method - Actual mean

LevAggr.Operation := BasicAggregatorOperation.ActualMean;

//Source level

LevAggr.Include(Lvl.Item(Lvl.Count - 1)) := True;

//Setup of aggregation by the first element of facts dimension

Dest := StandCub.Destinations.Item(0);

Dim.Aggregator(1, Dest) := BasicAggr;

MObj.Save;

End Sub Main;

After executing the example aggregation for the D_TO dimension is set up in the cube. Default levels are aggregated using arithmetic mean. Non-aggregated data is saved if the result is not an empty value. Own settings are set for the level next to last. Data is aggregated from the last level using the actual mean method.

See also:

IBasicMatrixLevelAggregator