abstra-docs
Search…
Formating numbers
Sometimes, you need to display numbers with distinct formats

Decimal places

If you need set a fixed number of decimal places, you can toggle JS mode and then usd toFixed method from Javascript.
The variable/data type should be number, otherwise the method toFixed will not be available.
Example on adding decimal places on number display

Using commas

Once you are in Javascript mode, you can always replace characters, like that:
1
$.salary.toFixed(2).replace(/\./g, ',')
Copied!

Using other formats

Additionally, you can use toLocaleString
1
$.salary.toLocaleString("pt-BR", {style: "currency", currency: "BRL"})
2
// "R$ 12.000,00"
Copied!
Last modified 2mo ago