Command AVERAGE Foundation
Calculates the average for numeric expressions in the current work area.
AVERAGE <nExpression,...> TO <VarName,...> ;
[FOR <lForCondition>] ;
[WHILE <lWhileCondition>] ;
[NEXT <nCount>] ;
[REST] ;
[ALL]
The command AVERAGE calculates the average of one or more numeric expressions based on the values of the records in the current work area. Specifying a condition or the number of records limits the records used in calculating the averages. The command sums the numeric expressions and divides the result at the end by the number of records included. The average of each numeric expression in <nExpression,...> is assigned to a variable in the list <VarName,...>.
// In the example, the average daily sales for the
// month of June are calculated.
PROCEDURE Main
LOCAL nIncomeJune
USE Invoice NEW
AVERAGE Payment TO nIncomeJune ;
FOR Month(InvDate) == 6
? "Average daily sales in June:", nIncomeJune
USE
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.