-
briar3462Asked on November 6, 2021 at 11:22 AM
Hi!
I'm trying to insert the comma in a number that is calculated using the form calculator. Please see my form, "Add a comma to number" or https://form.jotform.com/202476530063045
For instance, if you look at the "paragraph" field that I use in the form, it shows the total of number one + number two. This works fine if I'm adding any number under 1,000 (e.g. 500+200 = 700).
However, if I add numbers that total over 1,000, then I want the paragraph field to show the number with the comma in it. Right now, if I were to add (for example) 1,000 + 2,000 then the total number in the paragraph field shows "3000" but I want it to show "3,000".
Is there a way to 1) detect if the number in the total field is 4 digits and 2) if it IS 4 digits to insert a comma between the first and second digit?
Thank you for your help.
-
Saeed Support Team LeadReplied on November 6, 2021 at 12:23 PM
Hi there,
Thank you for writing to us!
If you want to separate large numbers with a comma, you can use the commaSeparate() Math Function.
Reference: Form Calculation - Math Function Reference
It will include comma separators in large numbers.
You should use the following format: commaSeparate(number value)
Here is an example:
I hope that helps. Please let us know if you need further assistance regarding this matter.
-
John Support Team LeadReplied on November 6, 2021 at 12:29 PM
You can use the commaSeparate function in the Form Calculation field. No need to use substring widgets.
Here's how:
Here's a demo form: https://form.jotform.com/213094582527964