How to asign score to responses?

Hi Community,

Someone, please help with fixing the If statement on the issue below

I am developing a questionnaire with one of the questions asking respondents: <How many times have you attended activity X? It is a Select One option response type of question with responses ranging from 1-10 times?-See image of question below.

I want to assign a score for each of the following possible responses, as follows:

  • Responses of 1 or 2 times to get a score of 2;
  • Responses of scores 3 or 4 times to get a score of 4;
  • Responses of 5 or 6 times to get a score of 6;
  • Responses of 7 of 8 times to get a score of 8, and
  • Responses of 9 or 10 times to get a score of 10

In my XLS form builder, I have input the following IFS statement: if(${Score}>=9,β€œ10”, if(${Score}>=8,β€œ8”, if(${Score}>=6,β€œ6”, if(${Score}>=4, or if(${Score}>=2,β€œ4”,β€œ2”)))

But when I try to upload the form, the following error message pops up:

DK Validate Errors: >> XForm is invalid. : Invalid calculate for the bind attached to β€œ${Score}” : Couldn’t understand the expression starting at this point: …/Score >=4, or͎if( /aKrfUmicqS… in expression if( ${Score} >=9,β€œ10”, if( ${Score} >=8,β€œ8”, if( ${Score} >=6,β€œ6”, if( ${Score} >=4, or if( ${Score} >=2,β€œ4”,β€œ2”))) The following files failed validation: ${tmp80k7kxmy} Result: Invalid

Please help me fix this.

Thank you in advance.

Mashate

Hello @smashate

May be this post could help you out.

1 Like

This is invalid syntax. Try removing the β€˜or’ sub-expression. You also dont really need the quotes around the resultant values either. Also, your range checks are a bit off from what you describe…

Try this:

if(${Score}>=9, 10, if(${Score}>=7, 8, if(${Score}>=5, 6, if(${Score}>=3, 4, 2))))

1 Like