Aggregation Functions

Aggregation Functions

Numeric aggregation functions

$sum()

Signature: $sum(array)

Returns the arithmetic sum of an array of numbers. It is an error if the input array contains an item which isn't a number.

Example

  • $sum([5,1,3,7,4]) => 20

$max()

Signature: $max(array)

Returns the maximum number in an array of numbers. It is an error if the input array contains an item which isn't a number.

Example

  • $max([5,1,3,7,4]) => 7

$min()

Signature: $min(array)

Returns the minimum number in an array of numbers. It is an error if the input array contains an item which isn't a number.

Example

  • $min([5,1,3,7,4]) => 1

$average()

Signature: $average(array)

Returns the mean value of an array of numbers. It is an error if the input array contains an item which isn't a number.

Example

  • $average([5,1,3,7,4]) => 4

    • Related Articles

    • Sorting Grouping and Aggregation

      Sorting, Grouping and Aggregation Fuuz Context Where this applies in Fuuz: Sorting, grouping, and aggregation are core to building rollups in Fuuz Pipelines—e.g., summarizing production counts per SKU, batching work orders, and preparing totals ...
    • Higher Order Functions

      Higher order functions $map() Signature: $map(array, function) If the input argument is an array of 2 or more elements, returns an array containing the results of applying the function parameter to each value in the array parameter. $map([1,2,3], ...
    • Boolean Functions

      Boolean functions $boolean() Signature: $boolean(arg) Casts the argument to a Boolean using the following rules: | Argument type | Result | | ------------- | ------ | | Boolean | unchanged | | string: empty | false| | string: non-empty | true | | ...
    • Numeric Functions

      Numeric functions $number() Signature: $number(arg) Casts the arg parameter to a number using the following casting rules - Numbers are unchanged - Strings that contain a sequence of characters that represent a legal JSON number are converted to that ...
    • Object Functions

      Object functions Fuuz Context Where this applies in Fuuz: Object utilities help normalize heterogeneous payloads from connectors, merge partial updates, and emit well-formed objects to Fuuz topics. $keys/$lookup: Discover and retrieve fields across ...