A.6 Aggregate Functions

Aggregate functions calculate values based on a list of values. The function can be applied to any value that contains a list, including sub-queries and sub-selections. In all functions, if the list value is null, it is treated as an empty list.

Sum

The Sum function calculates the total of the values in a list.

revenue > sum(query('ne-sales'))

Like all computational expressions, the values in the list are all converted to doubles to calculate the total. If any value on the list is not a number or a string convertible to a number, the value is converted to a zero.

Avg

The Avg function calculates the average of the values in a list.

price > avg(filter('product.price'))

The average is calculated as a double value. All items on the list, regardless of whether they are valid numbers, are counted into the average. All non-numeric values are treated as zero.

The Min function returns the minimum value on a list.

price = min(filter('product.price'))

Max

The Max function returns the maximum value on a list.

price = max(filter('product.price'))

Count

The Count function returns the number of items on a list.

count(query('PDAs')) > 10

<< A.5.2 List Regular Expression Matching © 1996-2013 InetSoft Technology Corporation (v11.4) A.7 Sub-Query >>