Command SUM Foundation
Calculates sums for numeric expressions in the current work area.
SUM <nExpression,...> TO <VarName,...> ;
[FOR <lForCondition>] ;
[WHILE <lWhileCondition>] ;
[NEXT <nCount>] ;
[REST] ;
[ALL]
The command SUM calculates the sum of one or more numeric expressions from the values of the records in the current work area. The range for the summation can be limited by specifying a condition or the number of records. The sum of each numeric expression in <nExpression,...> is assigned to a variable in <VarName,...>.
// In the example, the daily sales for the month of
// June are totaled.
PROCEDURE Main
LOCAL nIncomeJune
Use Invoice NEW
SUM Payment TO nIncomeJune ;
FOR Month(InvDate) == 6
? "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.