Articles in this section

toFixed helper

Use the toFixed helper to format a numeric value (or numeric string) to a fixed number of decimal places. It returns a string representing the rounded result.

Usage

{{toFixed field digits}}
  • field: A numeric field or literal (e.g., record.total or 123.456789).

  • digits: The number of decimal places to display (0 or greater).

Examples

  1. Formatting a record field 

    If record.tax is 29.7777, then:

    {{toFixed record.tax 2}}

    outputs "29.78".

  2. Literal value with different decimal places 

    {{toFixed 123.456789 4}}  →  "123.4568" {{toFixed 123.456789 0}}  →  "123"
  3. Using triple braces for raw output 

    {{{toFixed record.discount 2}}}

    Returns the string without any automatic formatting or quotes (e.g., 19.50).

Tip

  • If your input is not numeric or a numeric string, toFixed may produce NaN.

  • Values are rounded to the specified number of decimal places.

  • Consider whether you want raw output ({{{ }}}) or the platform’s default string formatting ({{ }}).