SUM

Returns the sum of the values displayed in the rows of the table control. The function accepts values only from textbox, label and literal controls. This function is called as <TableControlName>.SUM("<ControlName>"). Use a TableControl instance to indicate which TableControl contains the values to be operated on by the function, e.g., Order_DetailsTableControl, ProductsTableControl, CategoriesTableControl.

Note: This function is equivalent to the Page Total, and not the Grand Total.  Specifically, it does not return the sum of all of the records on all pages.  Only the sum of the records on the currently displayed set of rows is returned.

SUM() can be used anywhere within a table control, except within the repeater row area.

Syntax

= <TableControlName>.SUM(controlName)

Parameters

controlName

It represents the name of the control which contains the values whose sum is to be calculated. The controlName should be a string (e.g., “UnitPrice”, “Quantity”, “Discount”). The values in the control can be an integer (e.g., 37), a decimal value (e.g., 37.48), a string.

Return Type

Decimal

Examples

Example

Returns

= ProductsTableControl.SUM(“UnitPrice”)

The sum of the values displayed in the rows of the “UnitPrice” control.

= Order_DetailsTableControl.SUM("Quantity")

The sum of the values displayed in the rows of the “Quantity” control.

= Order_DetailsTableControl.SUM("Discount")

The sum of the values displayed in the rows of the “Discount” control.