How can I accept a Currency Formatted input and then do math on it? | XM Community
Question

How can I accept a Currency Formatted input and then do math on it?

  • 2 July 2021
  • 3 replies
  • 194 views

Userlevel 6
Badge +8

Qualtrics requires inputs to be numeric-only - not allowing "$" or "," (it accepts decimals). And a lot of times we want to accept inputs that are currency. Respondents want to see the $ and the "," between 1 and all those zeroes. But Qualtrics can't do mathematical calculations on those type of data.
Best case scenario would be to have the $ auto show up as the person types in the amount, and appropriate commas also auto entry...basically using a Currency Format. BUT then allow mathematical operations on it. Happy to have a way to create an Embedded Data variable that holds only the numerical representation and use that for the math.


3 replies

Userlevel 4
Badge +13

The best way would be to parseInt the string or maybe get the value in survey flow in numeric form and then perform the arithmetic operation. Or you can just create a function to add ',' in real time and then on pagesubmit to parseInt the value to number.

Userlevel 6
Badge +8

grahulp5 Thanks, but I have no idea what you mean. "just create a function", "pagesubmit", and "parseInt the value to number" sound very techno but I can't put any of that into action to solve the problem.
t

Userlevel 4
Badge +13

Just select the text entry type question with a label and do the math operation in JS section. or if it's not important to be a text entry then just give the option as a single punch if the list is not long.

Leave a Reply