Use the toExponential helper to convert a numeric value (or a numeric string) into exponential (scientific) notation. You may optionally specify how many digits you want to show after the decimal point.
{{toExponential field fractionDigits}}
-
field: The numeric field or value to format (e.g.,
record.totalor"12345"). -
fractionDigits (optional): How many digits to display after the decimal point.
-
Formatting a record field
{{toExponential record.orderId 2}}If
record.orderIdis"12345", the output is"1.23e4". -
Specifying a literal
{{toExponential "3.14159265359" 6}}Produces
"3.141593e+0", showing six digits after the decimal point. -
Using triple braces for raw output
{{{toExponential "12345" 2}}}Returns the unquoted exponential string, e.g.,
1.23e4.
Tip
-
Make sure the input is a valid number (or numeric string). Otherwise, the result may be
NaN. -
The
fractionDigitsparameter is optional; if omitted, it defaults to however many digits JavaScript typically provides. -
Consider whether you need raw or automatically formatted output. Triple braces (
{{{ }}}) return the result without extra formatting.