Aggregation Functions

Aggregation functions are used to group together multiple values to form a single summary value.

Count

The count function returns the number of elements within the given array.

Format

{%= count(array) %}

Example

The following operation returns the number of orders in the array.

{%= count(orders) %}

Sum

The sum function returns the sum of all the selected values within the array.

Format

{%= sum(array) %}

Example

The following operation returns the sum of all the orders’ prices.

{%=sum(orders.order.price)%}

Average

The average function returns the arithmetic mean of all the selected values within the array.

Format

{%= average(array) %}

Example

The following operation returns the average price of all the orders.

{%=average(orders.order.price)%}

Minimum

The min function returns the smallest of all the selected values within the array.

Format

{%= min(array) %}

Example

The following operation returns the lowest price of all the orders.

{%=min(orders.order.price)%}

Maximum

The max function returns the largest of all the selected values within the array.

Format

{%= max(array) %}

Example

The following operation returns the highest price of all the orders.

{%=max(orders.order.price)%}

On this page