Number Formatting
Last updated
Last updated
To format numbers on CrossEngage, you should use the formatDigits
function. The syntax of this formatting function is:
Please note that the formatDigits helper function only works when used with either the #includeProducts
or #findProduct
helper function.
Using the helper function #findProduct
, we search for a particular sku
and format the result's [properties.price]
attribute. We use 2000
as the value of the product's price for the example below.
Once the function is evaluated, it displays 2.000,00
in the section where it is used in the message.
Property
Type
Description
propertyName
string
Required. The attribute containing the value that is used for formatting. e.g. [properties.price]
numberDecimals
integer
Required. The number of decimals that is displayed. e.g. 2
decimalSeparator
string
Optional. The string that is used to separate decimals e.g. ,
thousandsSeparator
string
Optional. The string that is used to separate thousands e.g. .
percentage
boolean
Optional. This option specifies whether the value should be formatted as a percentage or not. e.g. true