sum (Addition)

See also: calc (Calculate expression)

The function $sum forms a sum over the passed parameters. The parameters can either be a fixed numeric value or another expression that returns a numeric value. You can use any number of parameters in this function.

Syntax

$sum(a [, b[, c[...]]])

Parameter

Name

Description

a

First summand, a value (e.g. ' 5 '), a list (e.g. $el(3,true) ) or a reference to a value (e.g. $el(3) ).

Other parameters

Other summands of type a.

Return value

The result of the addition over all summands.

Example

The sum over the contents of the fields with the indices 2, 3 and 4.

$sum( $el(2), $el(3), $el(4) )

The sum over all fields of the repeating element with the id 4.

$sum($el(4,true) )