{{getMsg('Help_YouAreHere')}}:
/
{{page.title}}
{{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}}
{{helpModel.downloadHelpPdfDataStatus}}
Sum
Computes the sum of the values of a field or an array. The field can be a database field, another formula or an SQL Expression field. Optionally a field can be used as condition to select the records for the function. The condition is a group.
Usage:
Sum( fld ) Sum( fld, condFld ) Sum( fld, condFld, cond ) Sum( array )
Parameters:
fld | The name of a field whose values should be summarized. |
---|---|
condFld | The name of the field that groups the values of fld (if fld isn't an array). |
cond | A string declaring the type of grouping to be used on condFld. This only makes sense for groups based on Date, DateTime, Time, and Boolean fields. See Summary Field Conditions for a list of strings you can use here. |
array | The name of an array variable whose values should be summarized. |
Returns:
Numeric value
Examples:
Crystal Syntax:
NumberVar x; x := Sum ( {MyTable.Price}, {MyTable.Lastname} ); // a group on {MyTable.Lastname} is required x := x / 2
Basic Syntax:
Dim x As Number x = Sum ( {MyTable.Price}, {MyTable.Lastname} ) // a group on {MyTable.Lastname} is required formula = x / 2
Notes:
-
If the values in fld should be grouped, a group based on condFld is needed. If the group does not exist in the report, you can add it using i-net Designer or using API method: Engine.addGroup.