sum
Adds up the numbers of a list or a set, or the values of one field of its items. Items whose value is not a number are left out. An empty list gives 0. A cloud set is summed on the server.
Runs on: either side: the compiler places the statement that calls it where the values it uses live.
Format:
sum(set_or_list [, field])
Parameters:
| Parameter | Type | Description |
|---|---|---|
| set_or_list | mixed | the set or list |
| field | string |  [Optional]the name of the field to add up; without it the items themselves are the numbers |
Returned Value:
| Type | Description |
|---|---|
| number | the total |
Examples
owed = sum(subset(invoices, "paid", false), "amount")