Showing results for 
Search instead for 
Did you mean: 

Rounding a number upto two decimal places

0 Kudos

Hi Team,

I need to use a helper that will format a decimal number and keep only 2 numbers after the decimal.

example : Now we are getting reponse as 542.87000000 and I want to display it as 542.87

There is no helper that I can use for the above requirement. Can you please help here?



Accepted Solutions (1)

Accepted Solutions (1)


Hi Nisha,

you're right that there is currently no helper for formatting numbers. It is planned to provide one, but we can currently not give any timeline.

Some tricks that might help:

  • If you just want to remove the trailing zeros after the decimal separator (e.g. 542.87000000 to 542.87), you can just convert the number from string to number by using {{add memory.myNumber 0}}. For numbers the trailing zeros will be removed.
  • The "round" helper that is available today only rounds to full numbers, but you can make use of it by multiplying by 100, applying the round helper and dividing the result by 100 again to achieve rounding to two decimal places:
{{divide (round (multiply memory.myNumber 100) ) 100}}


0 Kudos

The new formatNumber helper supports exactly this use case:

See Working with Numbers in Scripting Syntax documentation

Answers (0)