YOUSEFUL / DELPHI / COMPONENTS

TAtlasAggregate

The aggregate TAtlasPivot.Summarize computes: count, sum, minimum, maximum or average.

Enumeration Unit Atlas.Pivot · Product Atlas VCL

Description

Passed to TAtlasPivot.Summarize.

Members

MemberKindWhat it does
aaCountvalueThe number of source rows in the group, including rows whose value is empty; the value column may be of any kind.
aaSumvalueThe sum of the values; 0 for a group without values.
aaMinimumvalueThe smallest value; empty for a group without values.
aaMaximumvalueThe largest value; empty for a group without values.
aaAveragevalueThe mean of the original values of the group; empty for a group without values.

Values

aaCount value

aaCount

The number of source rows in the group, including rows whose value is empty; the value column may be of any kind.

aaSum value

aaSum

The sum of the values; 0 for a group without values.

aaMinimum value

aaMinimum

The smallest value; empty for a group without values.

aaMaximum value

aaMaximum

The largest value; empty for a group without values.

aaAverage value

aaAverage

The mean of the original values of the group; empty for a group without values.

Examples

Compare the aggregates

Prints the grand totals count 4, sum 350, minimum 20, maximum 150, average 87.5.

pascal
uses System.SysUtils, Atlas.Data, Atlas.Pivot;

procedure CompareAggregates(Sales: TAtlasTable);
const
  Names: array[TAtlasAggregate] of string = ('count', 'sum', 'minimum', 'maximum', 'average');
var
  Pivot: TAtlasPivot;
  Aggregate: TAtlasAggregate;
  Summary: TAtlasTable;
begin
  Pivot := TAtlasPivot.Create(nil);
  try
    for Aggregate := Low(TAtlasAggregate) to High(TAtlasAggregate) do
    begin
      Summary := Pivot.Summarize(Sales, 0, 1, 2, Aggregate);
      try
        // The last cell of the last row is the grand total.
        Writeln(Names[Aggregate].PadRight(9),
          Summary.Cell(Summary.ColumnCount - 1, Summary.RowCount - 1));
      finally
        Summary.Free;
      end;
    end;
  finally
    Pivot.Free;
  end;
end;

TAtlasPivot

Also in Atlas VCL

TAtlasTable · TAtlasGrid · TAtlasValueEdit · TAtlasTree · TAtlasWorkbook · TAtlasSheetGrid · TAtlasPivot · TAtlasInspector · TAtlasRichEdit · TAtlasSpellChecker · TAtlasChart · TAtlasGauge · TAtlasThemer · TAtlasWizard · TAtlasWorkspace · TAtlasCommandBar · TAtlasActionTile · TAtlasTileBoard · TAtlasNavigation · TAtlasMap · TAtlasGraph · TAtlasDiagram · TAtlasPrintDocument · TAtlasSchedule · TAtlasScheduler · TAtlasTaskPlan · TAtlasGantt · TAtlasPdfDocument · TAtlasPdfViewer