YOUSEFUL / DELPHI / COMPONENTS
TAtlasAggregate
The aggregate TAtlasPivot.Summarize computes: count, sum, minimum, maximum or average.
Description
Passed to TAtlasPivot.Summarize.
Members
| Member | Kind | What it does |
|---|---|---|
aaCount | value | The number of source rows in the group, including rows whose value is empty; the value column may be of any kind. |
aaSum | value | The sum of the values; 0 for a group without values. |
aaMinimum | value | The smallest value; empty for a group without values. |
aaMaximum | value | The largest value; empty for a group without values. |
aaAverage | value | The mean of the original values of the group; empty for a group without values. |
Values
aaCount value
aaCountThe number of source rows in the group, including rows whose value is empty; the value column may be of any kind.
aaSum value
aaSumThe sum of the values; 0 for a group without values.
aaMinimum value
aaMinimumThe smallest value; empty for a group without values.
aaMaximum value
aaMaximumThe largest value; empty for a group without values.
aaAverage value
aaAverageThe 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.
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;Related
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