List Math
Runs on: Shared (backend or chatbox overlay).
Computes Sum, Average, Min or Max across a list of numbers, or across one number field of a list of objects. Numbers and numeric text such as "42" count. Anything else is skipped: text, booleans, or an object with no resolvable field.
Min and Max also output the entry that held the winning value (the first, on a tie), so you can find who has the top score, not just what it is.
Inputs
| Name | Type | Description |
|---|---|---|
list | list | The list to compute over. |
field | string | Wire this to choose the number field at runtime instead of in the node. A field is required for lists of objects. |
Outputs
| Name | Type | Description |
|---|---|---|
result | number | The computed value. 0 for an empty list or one with no numeric values. |
item | (item type) | Min and Max only: the entry that held the winning value. Not sent for Sum or Average, or when there are no numeric values. |
Configuration
- Operation: Sum, Average, Min or Max.
- Field: Required for lists of objects. Not shown for lists of plain numbers.
Example
Feed a broadcaster leaderboard variable into List Math with Operation Max and Field score, then wire item into List To Text to announce {{item.username}} is in the lead with {{item.score}} points!.