Articles in this section

round helper

The round helper rounds a numeric value, including a numeric string, to the nearest whole integer. Builders use it in Handlebars templates — including field mappings, response mappings, HTTP request bodies, and dynamic API paths — to round values such as tax, totals, or other decimal fields in a record.

Usage

{{round field}}

field -- The field or variable containing a decimal or numeric string, for example record.vat. Required.

Examples

Round a tax amount

If record.vat is "29.77":

{{round record.vat}}

The result is 30.

Round down

If record.discount is 19.4, then {{round record.discount}} returns 19.

Output a raw number with triple braces

Use triple braces to return the rounded value without any automatic string formatting, such as added quotation marks. This is generally unnecessary for numbers.

{{{round record.fee}}}

Notes and constraints

  • If the field is already an integer, such as 42, the helper returns the same value.
  • Provide a valid numeric value or numeric string. If the input isn't numeric, the helper can return an error or an unexpected value.
  • For more control over decimal places or rounding behavior, use a more specific numeric helper if one is available.