Calculates the total of a column ofin a C/SIDE table. Using parameters, you can specify which fields to calculate.
[Ok :=] Record.CALCSUMS (Field1, [Field2],...)
The record that contains the SumIndexFields that you want to calculate.
- Field1, Field2, …
The fields that you want to calculate. Each field is a decimal field, defined as a SumIndexField, in the current key.
Property Value/Return Value
If you omit this optional return value and if one of the fields is not a SumIndexField, a run-time error occurs. If you include a return value, you must handle any errors.
Use this function to total columns in a table. This function operates only on records that meet the conditions of any filters associated with the record.
This example shows how to use the CALCSUMS function.
"Cust. Ledger Entry".SETCURRENTKEY("Customer No.","Date"); "Cust. Ledger Entry".SETRANGE("Customer No.", 'AAA 1050'); "Cust. Ledger Entry".SETRANGE("Date", 010196D, 123196D); "Cust. Ledger Entry".CALCSUMS("Amount");
The first line selects a key. The second and third lines set filters for the fields Customer No. and Date in the Cust. Ledger Entry record so the total is only calculated within the specified range. The CALCSUMS function then finds the net change in account AAA 1050 for 1996. The Amount field will show the result of the calculation.