Forum Discussion
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:
- Demo of what I'm trying to effect: http://concepts.s3.amazonaws.com/2-decimal-places/story.html
- Source file for the demo above: http://concepts.s3.amazonaws.com/2-decimal-places/source/community-Q-2%20decimals.story
- NorahColvin-3ccCommunity Member
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.
- HappilyCreativeCommunity Member
Yay! Steve to the rescue again. :) Such a help!
- NorahColvin-3ccCommunity Member
That's for sure. :)