ICalcAggr.Aggregator

Syntax

Aggregator(DimModel: IDimensionModel): IBasicMatrixAggregator;

Parameters

DimModel. Dictionary structure.

Description

The Aggregator property returns basic aggregation mechanism settings.

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier and a standard cube with the CUBE identifier. The calculation algorithm should contain an aggregation block, the cube should contain a dimension with the DIMENSIONS identifier.

Add links to the Algo, Cubes, Dimensions, Matrix, and Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo, Aggr: ICalcObject;
    List: ICalcObjectsList;
    CalcAlgo: ICalcAlgorithm;
    Block: ICalcAggr;
    Stub: IVariableStub;
    StandCub: IStandardCube;
    Dim: IStandardCubeDimension;
    Lvl: IDimLevels;
    BasicAggr: IBasicMatrixAggregator;
    LevAggr: IBasicMatrixLevelAggregator;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Get list of calculation algorithm objects
    List := CalcAlgo.Items;
    // Get aggregation block with the 0 index
    Aggr := List.Item(
0);
    Block := Aggr As ICalcAggr;
    // Get cube
    StandCub := MB.ItemById("CUBE").Edit As IStandardCube;
    Stub := StandCub As IVariableStub;
    // Set cube as data consumer
    Block.Stub := Stub;
    // Set up basic aggregation mechanism for specified dimension
    Dim := StandCub.Dimensions.FindById("DIMENSIONS");
    BasicAggr := Block.Aggregator(Dim.Dimension);
    // Get dimension levels
    Lvl := Dim.Dimension.Levels;
    // Set parameters for default level
    LevAggr := BasicAggr.DefaultLevelAggregation;
    LevAggr.Operation := BasicAggregatorOperation.ArithmeticalMean;
    LevAggr.PreserveExistingData := True;
    LevAggr.PreserveMethod := ExistingDataPreserveMethod.OnNull;
    // Save changes in aggregation block
    Block.SaveObject;
End Sub UserProc;

After executing the example, a standard cube is set as a data consumer for the aggregation block, and data aggregation is set up for the dimension with the DIMENSIONS identifier.

See also:

ICalcAggr