AVERAGE, AVG |
![]() ![]() ![]() |
The AVERAGE field qualifier keyword causes a field to be reported together with its average value. The synonym AVG may be used.
Format
AVERAGE field {field.qualifiers} {NO.NULLS}
where
The AVERAGE field qualifier keyword is placed before the field name to which it applies and causes the query processor to report the value of the field for each record processed and also to report the average value at the end of the report. Used with breakpoints, the AVERAGE keyword will also report the average value of the field at each breakpoint.
If the field is defined as multi-valued, the AVERAGE keyword operates on each value in turn.
The AVERAGE keyword operates only on numeric data. Non-numeric values are ignored.
The NO.NULLS keyword can be used to prevent null values being included in the calculation of the average value.
Example
The sentence
LIST INVOICES AVERAGE VALUE CUSTOMER.NAME WITH NO AMT.PAID
would produce a display such as that below in which the average value of the VALUE field is included at the end of the report.
LIST INVOICES AVERAGE VALUE CUSTOMER.NAME WITH NO AMT.PAID Invoice ...Value Customer................... 74529 £1712.43 J McTavish 74273 £95.23 County Newspapers 63940 £141.00 R Bryant 74993 £9.29 Write Right Stationery ======== £489.49 4 records listed. |