Skip to Content

Rounding a number upto two decimal places

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?



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 07, 2020 at 10:53 AM

    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}}


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.