Forum Discussion

MelAclaro's avatar
MelAclaro
Community Member
11 years ago

How to display 2-decimal places in variable calculations?

Hi gang.

I've set up a number variable to display a calculation when two other numbers on the panel are summed.

The calculation works okay. The thing is, since these are currency calculations, I'd like the summed variable to display with two decimal places.

For example: $2.33 + 1.17 should display as $3.50 and not $3.5

I'm hoping one of you heroes can give some guidance about how I can effect the former. Thanks in advance.

Update: Sorry, I should have further clarified... I'm pretty certain this is a javascript solution. I guess what can help me here is if any Heroes can either share an online reference where I can learn for myself the code I need to include in the Execute javascript trigger, or (better yet) if you've implemented such code before -- or know how? -- then, would you be willing to share it? Thanks in advance. Below are links to:

  • Thank you so much, Steve. That's brilliant. I had more errors than I realised. No wonder it wouldn't work for me. It's works perfectly now with your changes. Thank you for making the changes, but especially for explaining what I should have done. It was my first attempt with JavaScript so I have learned a little more. Your support is greatly appreciated.