- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 12:18 PM
I need to populate the 'contribution margin' field by adding the 'bill rate' and 'cost rate' fields (screenshot below). See in the info message that these values have letters and numbers. I tried this: var billRate = g_form.getValue('u_bill_rate');
var billRateArr = billRate.split(','); but larger numbers with commas were and the decimals were giving me issues. I'm not sure how to parse the numbers and add them before testing deadline tomorrow. Please advise!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 01:17 PM
Hi johanna,
I believe it may be connected to current computer regional settings.
There are couple of options, one is to use the attribute on this dictionary entry format:none as per documentation: none: Disables automatic number formatting (for example, changes 2,500–2500).
Since this is currency field you would still need to tweak it a little bit.
The other solution may look a bit dirty but works nicely.
See the example below, I read values from two fields and showing them in the info message to prove what is actually stored in it.
The currency field starts with currency letters and then semicolon followed by the number. And it is all string.
So you need to:
1. separate the number, so split the string by semicolon to two parts
2. take just the second part (index [1])
3. replace all commas with nothing (use replaceAll instead of replace)
4. finally convert this to Float to be able to work with numbers
Feel free to mark my answer as correct/helpful if it fixes your issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 01:17 PM
Hi johanna,
I believe it may be connected to current computer regional settings.
There are couple of options, one is to use the attribute on this dictionary entry format:none as per documentation: none: Disables automatic number formatting (for example, changes 2,500–2500).
Since this is currency field you would still need to tweak it a little bit.
The other solution may look a bit dirty but works nicely.
See the example below, I read values from two fields and showing them in the info message to prove what is actually stored in it.
The currency field starts with currency letters and then semicolon followed by the number. And it is all string.
So you need to:
1. separate the number, so split the string by semicolon to two parts
2. take just the second part (index [1])
3. replace all commas with nothing (use replaceAll instead of replace)
4. finally convert this to Float to be able to work with numbers
Feel free to mark my answer as correct/helpful if it fixes your issue.