How to format a numerical variable value to have commas and a specified number of decimals

I have two variables, and I am using an OnPageLoad case to add two of them to set the value of a widget.

2015-04-13_1508 - minitab2002’s library

However, the output is not formatted the way I’d like. I’d like it to read: “$1,000.50”, but it reads “$1000.5”.

2015-04-13_1514 - minitab2002’s library

How can I get the numerical value to format the way I want it to with the comma and two decimal places?
Electronic owner contributions.rp (3.84 MB)

1 Like

Wow, that is probably not worth the effort to output substrings. Thanks for the info. For reference, the relevant spot in the video is ~19:50.

Hello, I have a case where I am collecting several numeric values in a form on different pages of the form (a mortgage application). At the end, I need to generate a report that includes all of the values. I need to make the numbers display with appropriate commas as they are input throughout the form. I need to store their values in variables (right now I do this with OnLostFocus for each field but I could do using the submit button if I need to free up OnLostFocus?). Last, I perform math functions on the numbers (simple add/subtract) and display those numbers and results in the report page and I need to properly format them with commas. So, I really think I need to purge the commas from the variable before performing the math function or I need to purge the commas before creating the variables themselves. It’s a question of which is easier and how? Then I need to put the commas back into the results after the math function is performed so the results display properly in the final report. Can you help? Does this make sense?

Hi!

This works: add commas to field.rp (55.6 KB)

2 Likes

Thanks. That seems simple enough. I just need to use a different method to create my variables instead of OnLostFocus and do it before I add the comma’s and decimals. I’ll need to play around with this to see if I can make it work.

Got it to work well enough for my purposes, Just needed to set the variable first in the the sequence so it sets before the commas get added and it is able to add the user input and add commas appropriately. Thanks for making it very simple to do this. Great solution! I never thought about of using a local string that was a great idea that I can probably apply to a lot of other situations as well now. Thanks!