Welcome, Guest
Username: Password: Remember me

TOPIC: Check if more than one multiple choice has been selected

Check if more than one multiple choice has been selected 5 months 4 weeks ago #104435

  • arna
  • arna's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
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 administrator has disabled public write access.

Check if more than one multiple choice has been selected 5 months 3 weeks ago #104507

  • tomscher
  • tomscher's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 22
  • Thank you received: 5
  • Karma: 2
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 administrator has disabled public write access.

Check if more than one multiple choice has been selected 5 months 3 weeks ago #104542

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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:

{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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.121 seconds
Donation Image