DefaultLevelAggregation: IBasicMatrixLevelAggregator;
DefaultLevelAggregation: Prognoz.Platform.Interop.Matrix.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
StandCub: IStandardCube;
Man: MatrixAggregatorManager = New MatrixAggregatorManagerClass();
Dim: IStandardCubeDimension;
Lvl: IDimLevels;
BasicAggr: IBasicMatrixAggregator;
LevAggr: IBasicMatrixLevelAggregator;
Dest: IStandardCubeDestination;
Begin
MB := Params.Metabase;
StandCub := MB.ItemById["STD_CUBE"].Edit() As IStandardCube;
//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.insNone;
BasicAggr.UseSelection := True;
//For default level
LevAggr := BasicAggr.DefaultLevelAggregation;
LevAggr.Operation := BasicAggregatorOperation.baoArithmeticalMean;
LevAggr.PreserveExistingData := True;
LevAggr.PreserveMethod := ExistingDataPreserveMethod.edpmOnNull;
//For second level
//Destination level
LevAggr := BasicAggr.LevelAggregation[Lvl.Item[Lvl.Count - 2]];
LevAggr.UseDefaultLevelAggregation := False;
//Method - Actual mean
LevAggr.Operation := BasicAggregatorOperation.baoActualMean;
//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;
See also: