RUNNINGTOTAL

The running total represents an instantaneous total of the data which can be updated each time a new number is added to the sequence, simply by adding the new number to the running total. It is of use in Order Management portals which record the total of each order, and add the total of each order to the total of all the others after the order is placed to maintain the running total. If an order is cancelled, that sum is subtracted, and the running total continues to be maintained.

For example, if there are 5 rows belonging to the Order_DetailsTableControlRow containing values for UnitPrice control as 57, 32, 12, 19, and 98 then the running total for the row containing value 12 is 101, which is the sum of all the values in the rows before the row and including it. This function is called as <RecordControlName>.RUNNINGTOTAL("<ControlName>"). We need to use a RecordControl instance to indicate which RecordControl contains the values to be operated on by the function (e.g., Order_DetailsTableControlRow, ProductsTableControlRow, CategoriesTableControlRow).

Syntax

= <RecordControlName>.RUNNINGTOTAL(controlName)

Parameters

controlName

It represents the name of the control which contains the values whose running total is to be calculated for the specified record. 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

= ProductsTableControlRow.RUNNINGTOTAL(“UnitPrice”)

The running total of the values in the “UnitPrice” control which belongs to the ProductsTableControlRow.

= Order_DetailsTableControlRow.RUNNINGTOTAL(“Quantity”)

The running total of the values in the “Quantity” control which belongs to the Order_DetailsTableControlRow.

= CategoriesTableControlRow.RUNNINGTOTAL(“Discount”)

The running total of the values in the “Discount” control which belongs to the CategoriesTableControlRow.