SUMROWS

Description

Returns the sum of a set of values across multiple source rows. SUMROWS uses a label name to allow multiple values to be summed at the same time. Set Reset to TRUE to reset the sum to 0. Returns the current sum.

Syntax

SUMROWS ( name, value, reset )

Parameter Description
name Text label, allows multiple sums to be accumulated at the same time.
value Source Field (Sn) value to add to the total.
reset TRUE resets sum to 0 before adding value, FALSE, the default, adds value to accumulated sum

Remarks

The SUMROWS function keeps track of the last source row number for each "label", and only adds to the sum if the row number has changed.

Examples

This example sums source field S5 across all rows and assigns the value to "Total". The sum is not reset to 0.

SUMROWS ( "Total", S5, "FALSE" )

This example demonstrates resetting the sum to zero when totaling up the items ordered for each order invoice. In this example, if the NEXTITEMNUMBER = 1 (that is, if this is the first item for an order), then reset the order total to zero. If the NEXTITEMNUMBER is not 1, then keep adding up the items for this order. 

SUMROWS ( "OrderTotal", S14 , if(NEXTITEMNUMBER(S1 ) = 1,TRUE, FALSE) )

See also

SEQNUM

SETNAMEDVALUE