version 11.3 (Modified)
Average (series) Number
Parameter | Type | Description | |
series | Field | Data for which to return the average | |
Function result | Number | Arithmetic mean (average) of series |
Description
Average returns the arithmetic mean (average) of series. If series is an indexed field, the index is used to find the average.
If the command is correctly executed, the OK system variable is set to 1. If it is interrupted (for example if the user clicks on the Stop button of the progress thermometer), the OK variable is set to 0.
Example
The following example sets the variable vAverage that is in the B0 Break area of an output form. The line of code is the object method for vAverage. The object method is not executed until the level 0 break:
vAverage := Average ([Employees] Salary)
The following method is called to print the records in the selection and to activate break processing:
ALL RECORDS ([Employees]) ORDER BY ([Employees];[Employees]LastNm;>) BREAK LEVEL (1) ACCUMULATE ([Employees]Salary) OUTPUT FORM ([Employees];"PrintForm") PRINT SELECTION ([Employees])
Note: The parameter to the BREAK LEVEL command should be equal to the number of breaks in your report. For more information about break processing, refer to the printing commands.
See Also
ACCUMULATE, BREAK LEVEL, Max, Min, ORDER BY, PRINT SELECTION, Subtotal, Sum.