4 Functions

The AVG Function

The AVG function returns the average for the specified expression in the TOTALS ON statement. The value returned is a cumulative average since the header statement block, containing the TOTALS ON statement, was last invoked by break condition.

AVG (level, sequence)

The parameters are:

level
A numeric expression evaluating to an integer from 0 to 9. It associates the AVG function to a TOTALS ON statement in a header with the same level number. If level equals zero, the AVG function will reference the GRAND TOTALS ON statement.
sequence
A numeric expression evaluating to a positive integer. It corresponds to the sequential position of the desired expression in the TOTALS ON statement.
An example of this function follows.


70   GRAND TOTALS ON Qty*Price
.
.
.
265  REPORT TRAILER WITH 5 LINES USING R_trail;AVG(0,1)
The value returned is the grand total of Qty$\ast$Price divided by the number of detail lines (with number of one to nine) that have been executed.


Eloquence Report Manual - 19 DEC 2002