Aggregation functions
Aggregation functions calculate the average, total, minimum, or maximum value of the
numeric attributes in a collection of objects, or the number of objects in a collection.
Aggregation functions compute a value from a collection of values.
You cannot use aggregation functions in the action part of the rule.
| Syntax | Description | Example |
|---|---|---|
| the minimum of <list of numbers> [ defaulting to <numerical expression> ] | Returns the smallest value in a list. If the list is empty or null and no default value is
provided, the returned value is null. |
the minimum of the ages of 'the customers', where each number is at least 18 defaulting to 100 |
| the maximum of <list of numbers> [ defaulting to <numerical expression> ] | Returns the biggest value in a list. If the list is empty or null and no default value is
provided, the returned value is null. |
the maximum of { 'the good value', 'the bad value', 'the ugly value' } |
| the sum of <list of numbers> | Sums up the numbers in a list. If the list is empty or null, the returned value is
0. |
the sum of the ages of 'the customers', where each number is at least 18 |
| the average of <list of numbers> [ defaulting to <numerical expression> ] | Computes the average value of a list. If the list is empty or null and no default value is
provided, the returned value is 0. |
the average of 'the amounts' |
| the number of elements in <list> | Returns the total number of elements in a specific list. | the number of elements in 'the customers' |