Articles in this section

avg helper

Use {{avg}} to compute the average of all provided numeric values—integers, floats, or decimals. You can pass in numeric fields from the record or hard-coded values.

Usage

{{avg number1 number2 ...}}
  • number1, number2, ...: One or more numeric inputs (fields or literals) to be averaged.

Examples

  1. Averaging field values

    {{avg record.itemPrice record.shipping}}
    

    If record.itemPrice is 25 and record.shipping is 5, the output is 15.

  2. Combining multiple hard-coded numbers

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

    The sum is 9, divided by 3 inputs equals 3.

  3. Mixing fields and literals

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

    If record.item1Quantity is 6 and record.item2Quantity is 18, the output is (6 + 12 + 18) / 3 = 12.

Tip

  • Pass any number of arguments; the helper automatically sums and divides them.

  • Each argument must be numeric (or parseable as numeric) for accurate results.

  • The average is returned as a floating-point number if any inputs are floats or decimals.