Trying to get numerical choices from a question and to do math calculations | XM Community
Skip to main content
Solved

Trying to get numerical choices from a question and to do math calculations

  • November 12, 2018
  • 3 replies
  • 10 views

Christoph
Forum|alt.badge.img+2
After help from Shahi I got to the following code: ! This code concatenates the numerical answers, i.e. the choice may be "A lot", "Some" and "None" and I get '1', '2' or '3', depending on the choice of the user. However, if they choose the first (1) and third (3) option for the first two questions, the sum is not 4, but 13. Could you help? If this goes beyond community support, I would be happy to pay for somebody to help me.

Best answer by MohammedAli_Rajapkar

Can you try like below for first 2 variables... var pf1 = parseInt("${q://QID13/SelectedAnswerRecode/1}",10); var pf2 = parseInt("${q://QID13/SelectedAnswerRecode/2}",10); var x = (pf1+pf2);
View original

3 replies

MohammedAli_Rajapkar
QPN Level 5 ●●●●●
Forum|alt.badge.img+20
Can you try like below for first 2 variables... var pf1 = parseInt("${q://QID13/SelectedAnswerRecode/1}",10); var pf2 = parseInt("${q://QID13/SelectedAnswerRecode/2}",10); var x = (pf1+pf2);

PeeyushBansal
Level 6 ●●●●●●
Forum|alt.badge.img+39
  • Level 6 ●●●●●●
  • 1144 replies
  • November 13, 2018
It can happen when you have done any recoding in your question. Can you double check if there is any recoding present for this question

Christoph
Forum|alt.badge.img+2
  • Author
  • 8 replies
  • November 13, 2018
Thank you both. Mohammedali's fix worked.

Leave a Reply