The CALCSUMS function is conceptually similar to CALCFIELDS for the calculation of Sums only. However, CALCFIELDS operates on FlowFields and CALCSUMS operates directly on the record where the SumIndexFields are defined for the keys. This difference means that we must specify the proper key, plus any filters to apply when using CALCSUMS (the applicable key and filters to apply are already defined in the properties for the FlowFields).
The syntax for CALCSUMS is as follows:
[ BooleanField := ] Record.CALCSUMS ( SumIndexField1 [,SumIndexField2] ,...)
Prior to a statement of this type, we should specify a key that has the SumIndexFields defined (to maximize the probability of good performance). Before executing the CALCSUMS function, we also need to specify any filters that we want to apply to the Record from which the sums are to be calculated. The SumIndexFields calculations take into account the filters that are currently applied to the record.
Executing the CALCSUMS...