IPivot.AggregationElement

Syntax

AggregationElement: Integer;

Description

The AggregationElement property determines the element, by which matrix aggregated data is available by fixed dimensions.

Comments

Data aggregation method on multiple selection in fixed dimensions is set in the IPivot.FixedElementsAggregation property. To save aggregated data in output matrix, set some negative element index in the AggregationElement property. To get aggregated data, set in matrix coordinate as an element for the last dimension the element index specified in AggregationElement.

To check if data is aggregated, use the IPivot.IsAggregationCalced property.

Example

Executing the example requires that the repository contains an express report with the EXPRESS identifier. Data source dimensions contain a dimension with the COUNTRY identifier. This dimension is included in the report into the list of fixed ones.

Add links to the Dimensions, Express, Matrix, Metabase, Pivot system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Analyzer: IEaxAnalyzer;
    Pivot: IPivot;
    DimSel: IDimSelection;
Begin
    MB := MetabaseClass.Active;
    Analyzer := MB.ItemById("EXPRESS").Bind As IEaxAnalyzer;
    //Table with express report data
    Pivot := Analyzer.Pivot;
    Pivot.FixedElementsAggregation := PivotAggregationOperation.None;
    //Display matrix in console window
    LogMatrix(Pivot.Matrix);
    Debug.WriteLine("=======================================================");
    Pivot.FixedElementsAggregation := PivotAggregationOperation.Sum;
    //Element, by which aggregated data is available
    Pivot.AggregationElement := -2;
    DimSel := Pivot.Selection.FindById("COUNTRY");
    DimSel.SelectElement(0False);
    DimSel.SelectElement(1False);
    DimSel.SelectElement(2False);
    //Display matrix in console window
    LogMatrix(Pivot.Matrix);
    //Check aggregation result
    Debug.WriteLine("=======================================================");
    If Pivot.IsAggregationCalced Then
        Debug.WriteLine("Aggregation is calculated")
    Else
        Debug.WriteLine("Aggregation is not calculated");
    End If;
End Sub UserProc;

//Display matrix in console window
Sub LogMatrix(Matrix: IMatrix);
Var
    Iterator: IMatrixIterator;
    Coord: IMatrixCoord;
    Item: String;
    i: Integer;
Begin
    Iterator := Matrix.CreateIterator;
    Coord := Matrix.CreateCoord;
    Iterator.Move(IteratorDirection.First);
    Debug.WriteLine("Elements:");
    While Iterator.Valid Do
        Iterator.PutCurrentPos(Coord);
        Item := "[";
        For i := 0 To Coord.Count - 1 Do
            If i > 0 Then
                Item := Item + ", ";
            End If;
            Item := Item + Coord.Item(i).ToString;
        End For;
        Item := Item + "] ";
        Item := Item + (Iterator.Value As Double).ToString;
        Debug.WriteLine(Item);
        Iterator.Move(IteratorDirection.Next);
    End While;
End Sub LogMatrix;

On executing the example the development environment console displays two matrices: the matrix with table source data and the matrix obtained after aggregation on multiple selection in the COUNTRY fixed dimension. Aggregated values are saved by the -2 element.

See also:

IPivot