LevelAggregation(kLevel: Integer): IChronologicalMatrixLevelAggregator;
kLevel - key of dimension level, for which it is necessary to set up aggregation parameters. If it is required to set aggregation parameters for default levels, assign the value "-1" to this parameter.
The property is read-only.
The LevelAggregationByKey property returns aggregation parameters for level of the dimension specified by the key.
Executing the example requires that the repository contains a cube with the Cube_1 identifier. The cube includes the calendar dimension CALENDAR that contains several levels.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StandCub: IStandardCube;
Man: IMatrixAggregatorManager;
Dim: IStandardCubeDimension;
Lvls: IDimLevels;
LvlsCount: Integer;
LvlsKey: Integer;
ChronAggr: IChronologicalMatrixAggregator;
LevAggr: IChronologicalMatrixLevelAggregator;
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
ChronAggr := Man.CreateAggregator("ChronologicalMatrixAggregator") As IChronologicalMatrixAggregator;
//For CALENDAR dimension
Dim := StandCub.Dimensions.FindById("CALENDAR");
Lvls := Dim.Dimension.Levels;
LvlsCount := Lvls.Count;
ChronAggr.Dimension := Dim.Dimension;
//For default levels
LevAggr := ChronAggr.LevelAggregationByKey(-1);
LevAggr.Operation := ChronologicalAggregatorOperation.Mean;
//For the level next to last
LvlsKey := Lvls.Item(LvlsCount - 2).Key;
LevAggr := ChronAggr.LevelAggregationByKey(LvlsKey);
LevAggr.UseDefaultLevelAggregation := False;
LevAggr.Operation := ChronologicalAggregatorOperation.UniformDisaggregation;
LevAggr.SourceLevel := Lvls.Item(LvlsCount - 1);
//Setup of aggregation by the first element of facts dimension
Dest := StandCub.Destinations.Item(0);
Dim.Aggregator(1, Dest) := ChronAggr;
MObj.Save;
End Sub Main;
After executing the example the aggregation for the CALENDAR dimension is set up in the cube. Chronological aggregation mechanism is used. Aggregation with the use of chronological mean is performed for default levels. Own settings are set for the level next to last. Proportional disaggregation to the last level is performed.
See also: