DefaultLevelAggregation: IBasicMatrixLevelAggregator;
The DefaultLevelAggregation property determines aggregation parameters for default dimensions levels.
These settings are used on all levels, for which the UseDefaultLevelAggregation property is set to True.
Executing the example requires that the repository contains a cube with the STD_CUBE identifier. The cube includes the D_TO dimension that contains more than two levels. Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StandCub: IStandardCube;
Man: IMatrixAggregatorManager;
Dim: IStandardCubeDimension;
Lvl: IDimLevels;
BasicAggr: IBasicMatrixAggregator;
LevAggr: IBasicMatrixLevelAggregator;
Dest: IStandardCubeDestination;
Begin
MB := MetabaseClass.Active;
StandCub := MB.ItemById("CUBE_1").Edit As IStandardCube;
//Create a new aggregator
Man := New MatrixAggregatorManager.Create As IMatrixAggregatorManager;
//Main aggregation method
BasicAggr := Man.CreateAggregator("BasicMatrixAggregator") As IBasicMatrixAggregator;
//For D_TO dimension
Dim := StandCub.Dimensions.FindById("D_TO");
Lvl := Dim.Dimension.Levels;
BasicAggr.Dimension := Dim.Dimension;
BasicAggr.IgnoreNulls := IgnoreNullsState.None;
BasicAggr.UseSelection := True;
//For default level
LevAggr := BasicAggr.DefaultLevelAggregation;
LevAggr.Operation := BasicAggregatorOperation.ArithmeticalMean;
LevAggr.PreserveExistingData := True;
LevAggr.PreserveMethod := ExistingDataPreserveMethod.OnNull;
//For 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;
//Set aggregation by the first element of fact dimension
Dest := StandCub.Destinations.Item(0);
Dim.Aggregator(1, Dest) := BasicAggr;
(StandCub As IMetabaseObject).Save;
End Sub UserProc;
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. Aggregation is performed by selected dimension elements.
See also: