IBasicMatrixLevelAggregator.Include

Syntax

Include(SourceLevel: IDimLevel): Boolean;

Include[SourceLevel: Prognoz.Platform.Interop.Dimensions.IDimLevel]: Boolean;

Parameters

SourceLevel. Source level which data must be sent on aggregation.

Description

The Include property determines whether data of level sent using input parameter are used on aggregation.

Comments

If the property is set to True, data of the SourceLevel level is used during aggregation, otherwise, it is not used. The property is relevant if the UseDefaultLevelAggregation and IncludeChildren properties are set to False.

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.

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
    MB := MetabaseClass.Active;
    MObj := MB.ItemById(
"CUBE_1").Edit;
    StdCube := MObj 
As IStandardCube;
    
//Create a new aggregator
    Man := New MatrixAggregatorManager.Create As IMatrixAggregatorManager;
    
//Main aggregation mechanism
    BasicAggr := Man.CreateAggregator("BasicMatrixAggregator"As IBasicMatrixAggregator;
    
//For the D_TO dimension
    Dim := StdCube.Destinations.Item(0).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 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 := StdCube.Destinations.Item(0);
    Dim.Aggregator(
1, Dest) := BasicAggr;
    MObj.Save;
End Sub UserProc;

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;
    MObj: IMetabaseObject;
    StdCube: IStandardCube;
    Man: IMatrixAggregatorManager = 
New MatrixAggregatorManagerClass();
    Dim: IStandardCubeDimension;
    Lvl: IDimLevels;
    BasicAggr: IBasicMatrixAggregator;
    LevAggr: IBasicMatrixLevelAggregator;
    Dest: IStandardCubeDestination;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById[
"CUBE_1"].Edit();
    StdCube := MObj 
As IStandardCube;
    
//Main aggregation mechanism
    BasicAggr := Man.CreateAggregator("BasicMatrixAggregator"As IBasicMatrixAggregator;
    
//For the D_TO dimension
    Dim := StdCube.Destinations.Item[0].Dimensions.FindById("D_TO");
    Lvl := Dim.Dimension.Levels;
    BasicAggr.Dimension := Dim.Dimension;
    
//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 := StdCube.Destinations.Item[0];
    Dim.Aggregator[
1, Dest] := BasicAggr;
    MObj.Save();
End Sub;

After executing the example the 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