Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Check if more than one multiple choice has been selected

More
10 years 10 months ago #104435 by arna
Hello, I am new to Limesurvey - thanks for the fantastic software and good documentation. It is refreshing to use open-source which is so established and well maintained. I will definitely make a donation or contribute otherwise :)

One thing I am a bit stuck on and would appreciate help with:

I need to write an expression which checks whether more than one multiple choice has been chosen.

Is there a way of assigning the value 1 to subquestions so I could use something like: count(that.Qcode.value) > 1 ??

Thanks
The topic has been locked.
More
10 years 10 months ago #104507 by tomscher
Hi,
Not sure what kind of question you are using and what you want to do in the long run...
I assume it's the "Array Numbers (Checkbox Layout)" version with 5 columns and only one row.

You could try to fill this in a question afterwards:

{if(sum(Test_A_1, Test_A_2, Test_A_3, Test_A_4, Test_A_5) > 1, "More than one alternative was selected", "One or no alternative was selected")}

If you just want to validate the number of checked alternatives, then you can simply use the same idea (without the if-clause) in the validate answer field of the respective question.

Does that help?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago #104542 by tpartner
You cannot assign assessment values to Multiple Choice subquestions. However given a Multiple Choice with question code "Q1" and sub-question codes "A1", "A2", "A3", "A3", you can use an equation like this:

Code:
{if(sum(Q1_A1 == "Y", Q1_A2 == "Y", Q1_A3 == "Y", Q1_A4 == "Y") > 1, 'More than one checked', '')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose