For the complete documentation index, see llms.txt. This page is also available as Markdown.

$sum

Computes the sum of the values.

This function has multiple signatures

{{$sum array [format]}}

Computes the sum of numbers in an array.

Arguments

Name
Description
Type
Required

array

List of numbers to sum.

Number Array

format

Format string used to format the result

String

Example

{{$sum hours_worked}}
{
    "hours_worked": [3, 6, 4, 12]
}

25

Returns

Returns the total.

{{$sum number1 number2 [...] [format]}}

Computes the sum of numbers passed as arguments.

Arguments

Name
Description
Type
Required

number1

The first number to sum.

Number

number2

The second number to sum.

Number

[...]

The remaining numbers to sum.

Number

format

Format string used to format the result

String

Example

{{$sum subtotal discount tax}}
{
    "subtotal": 150,
    "discount": -20,
    "tax": 6.50
}

136.5

Returns

Returns the total.

{{$sum collection path [format]}}

Computes the sum of numbers within a collection (an array of objects).

Arguments

Name
Description
Type
Required

collection

An array of objects

Collection

path

Path to the number property on each object.

String

format

Format string used to format the result

String

Example

875.89

Returns

Returns the total.

Last updated

Was this helpful?