Articles in this section

toPrecision helper

Use the toPrecision helper to format a number (or numeric string) so that it has a specified number of significant digits. If the number of integer digits exceeds the precision, the output switches to scientific notation automatically.

Usage

{{toPrecision field precision}}
  • field: The numeric field or value to format.

  • precision: The desired number of significant digits.

Examples

  1. Switching between regular and scientific notation 

    {{toPrecision 123.00 2}}   →  "1.2e+2" {{toPrecision 123.00 3}}   →  "123"

    When the integer part fits within the specified precision, the helper produces a standard decimal notation; otherwise, it uses exponential notation.

  2. Handling larger numbers 

    {{toPrecision 123456 5}}   →  "1.2346e+5" {{toPrecision 1234567.00 6}} → "123456"
  3. Using a record field and triple braces 

    {{{toPrecision record.total 4}}}

    Returns the formatted result without Celigo’s automatic string wrapping, e.g., 9.876e+3 or 9876 depending on the value.

Tip

  • Ensure your input is numeric or a valid numeric string to avoid NaN.

  • Setting precision too low (e.g., 0 or 1) will quickly push even moderate numbers into exponential notation.

  • Use triple braces ({{{ }}}) if you need the exact raw output without additional formatting.