The sum operator adds the values in a specified field among all the records that are processed.
Syntax
FIELDNAME | VARIABLE : sum [other statistical operators] ; | .
Returns
A numeric value
Usage
The value returned by the sum operator differs depending on where its corresponding Summary field appears in the document layout. The effect of the position of the Summary field on the sum value is summarized in the table below.
Location |
Sum |
Document Header or Footer |
N/A |
Main form object |
Grand total |
Group Form object |
Group total |
for MEMBERS with TOTAL DUE > 175 ;
This script tells DataEase: (1) Process all the MEMBERS records that have a value greater than $175 in the TOTAL DUE field, (2) list the members by LAST NAME in alphabetical order, and (3) list each member's TOTAL DUE and include the sum of all the TOTAL DUE amounts in the report output.
The output from this script might look as follows:
Last Name |
Total Due |
Christino |
$280.00 |
Perrault |
$215.00 |
Stafford |
$185.00 |
Strachan |
$205.00 |
Sum Total Due: |
$885.00 |
Note: There's an important difference between the statistical operator sum and the relational statistical operator sum of. sum returns the total of the values in the specified field among the records being processed. sum of returns the total of the values in the specified field among the records related to the records being processed.