Welcome to the LimeSurvey Community Forum

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

Setting a maximum number of options on an array-checkbox question

  • BarbaraB12
  • BarbaraB12's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #226546 by BarbaraB12
Your LimeSurvey version: 3.1

Dear Forum Friends,

I would like to set a validation equation for each sub-question of my checkbox array question. This question already has an array filter from a previous question (meaning, users are only prompted to answer for options they have selected in a previous question). Now I want to ensure that they only select up-to 3 options per row in this question. I wrote this equation to try to account for the fact that some rows will remain empty, but I get stuck and cannot move to the following page, no matter what I do. 

((is_empty(self.sq_a) OR count(self.sq_a) <= 3)) AND ((is_empty(self.sq_b) OR count(self.sq_b) <= 3)) AND ((is_empty(self.sq_c) OR count(self.sq_c) <= 3)) AND ((is_empty(self.sq_d) OR count(self.sq_d) <= 3)) AND((is_empty(self.sq_e) OR count(self.sq_e) <= 3))  AND ((is_empty(self.sq_f) OR count(self.sq_f) <= 3)) AND ((is_empty(self.sq_g) OR count(self.sq_g) <= 3))  AND ((is_empty(self.sq_h) OR count(self.sq_h) <= 3)) AND ((is_empty(self.sq_j) OR count(self.sq_j) <= 3))

Can you help me write the right code? 

Thanks a lot in advance.

Best,

Barbara.

Please Log in to join the conversation.

  • BarbaraB12
  • BarbaraB12's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #226557 by BarbaraB12
I solved my question, in case somebody else experiences the same problem in the future:

(count(self.sq_a.NAOK) <= 3) AND (count(self.sq_b.NAOK) <= 3) AND (count(self.sq_c.NAOK) <= 3) AND (count(self.sq_d.NAOK) <= 3) AND (count(self.sq_e.NAOK) <= 3) AND (count(self.sq_f.NAOK) <= 3) AND (count(self.sq_g.NAOK) <= 3) AND (count(self.sq_h.NAOK) <= 3) AND (count(self.sq_j.NAOK) <= 3)
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose