QUOTE
3.6 Aggregate functions
In most cases, group reports need to display some summary result information
(such as: “total of a group,” “number of group elements,” etc). FastReport provides these
aggregate functions this purpose. With their use, one can retrieve the defined aggregate
value over a data span. The list of aggregate functions:
SUM Returns the total of the expression
MIN Returns the minimal value of the expression
MAX Returns the maximal value of the expression
AVG Returns the average value of the expression
COUNT Returns the number of lines (rows) in the data span
The syntax of all aggregate functions (except COUNT) is as shown below, using an
example of the “SUM” function):
SUM(expression, band, flags)
SUM(expression, band)
SUM(expression)
The parameters assignment is as follows:
expression – the expression, the value of which will be handled
band – the name of data band, on which the value(s) to be handled originally reside
flags – a bit field, which can be the following values or their sum
1 – include invisible bands in calculation
2 – accumulate the value or running total(do not reset the result value when the
current data span resets)
An expression is the only mandatory parameter; all the rest are optional.
Nevertheless, it is recommended to always use band parameters, to avoid mistakes.
The “COUNT” function has the following syntax:
COUNT(band, flags)
COUNT(band)
The parameters assignment is similar to the one described above.
There is a general rule for all aggregate functions: a function can be counted only
for the data-band and used only in that band’s footer (the following bands refer to the
latter: footer, page footer, group footer, column footer, and report footer( summary band)
).