Include(SourceLevel: IDimLevel): Boolean;
SourceLevel. Source level which data must be sent on aggregation.
The Include property determines whether data of the specified level is used in aggregation.
Available values:
True. Data of the SourceLevel level will be used in aggregation.
False. Data of the SourceLevel level will not be used in aggregation.
The property is relevant if the IBasicMatrixLevelAggregator.UseDefaultLevelAggregation and IBasicMatrixLevelAggregator.IncludeChildren properties are set to False.
Executing the example requires that the repository contains a cube with the CUBE identifier. The cube contains a dimension with the D_TO identifier containing more than two levels.
Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StdCube: IStandardCube;
Man: IMatrixAggregatorManager;
Dim: IStandardCubeDimension;
Lvl: IDimLevels;
BasicAggr: IBasicMatrixAggregator;
LevAggr: IBasicMatrixLevelAggregator;
Dest: IStandardCubeDestination;
Begin
// Open cube for edit
MB := MetabaseClass.Active;
MObj := MB.ItemById("CUBE").Edit;
StdCube := MObj As IStandardCube;
// Create a new aggregator
Man := New MatrixAggregatorManager.Create As IMatrixAggregatorManager;
// Specify basic aggregation mechanism
BasicAggr := Man.CreateAggregator("BasicMatrixAggregator") As IBasicMatrixAggregator;
// Determine settings for the D_TO dimension
Dim := StdCube.Destinations.Item(0).Dimensions.FindById("D_TO");
Lvl := Dim.Dimension.Levels;
BasicAggr.Dimension := Dim.Dimension;
// Determine settings for default level
LevAggr := BasicAggr.DefaultLevelAggregation;
LevAggr.Operation := BasicAggregatorOperation.ArithmeticalMean;
LevAggr.PreserveExistingData := True;
LevAggr.PreserveMethod := ExistingDataPreserveMethod.OnNull;
// Determine settings for consumer level
LevAggr := BasicAggr.LevelAggregation(Lvl.Item(Lvl.Count - 2));
LevAggr.UseDefaultLevelAggregation := False;
// Set the Actual Mean aggregation option
LevAggr.Operation := BasicAggregatorOperation.ActualMean;
// Determine settings for source level
LevAggr.Include(Lvl.Item(Lvl.Count - 1)) := True;
LevAggr.IncludeChildren := False;
// Set aggregation by the first fact dimension element
Dest := StdCube.Destinations.Item(0);
Dim.Aggregator(1, Dest) := BasicAggr;
// Save cube
MObj.Save;
End Sub UserProc;
After executing the example the aggregation for the D_TO dimension is set up in the cube. Values from the source level are used in aggregation. 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: