Articles in this section

avg helper

The avg helper calculates the arithmetic mean of two or more numeric values in integrator.io. Pass in numeric fields from the record, hard-coded literals, or a mix of both. The helper accepts integers, floats, and numeric strings.

Syntax

{{avg number1 number2...}}

number1, number2,... -- Two or more numeric fields or literal values to average. Each argument must be numeric or parseable as numeric.

Examples

Average two field values

{{avg record.itemPrice record.shipping}}

Input: record.itemPrice is 25, record.shipping is 5
Output: 15

Average hard-coded literals

{{avg "2" "5" "2"}}

Output: 3 (sum 9 ÷ 3 inputs)

Mix fields and literals

{{avg record.item1Quantity "12" record.item2Quantity}}

Input: record.item1Quantity is 6, record.item2Quantity is 18
Output: 12 ((6 + 12 + 18) ÷ 3)

Usage notes

  • You can pass any number of arguments; the helper sums all inputs and divides by the count automatically.
  • If any input is a float or decimal, the result is returned as a floating-point number.
  • All arguments must be numeric or parseable as numeric. Non-numeric values produce inaccurate results.