Welcome to the LimeSurvey Community Forum

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

How to restrict number of times a column in array can be selected?

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 10 months ago - 1 year 10 months ago #228057 by blocka
Your LimeSurvey version: 3.28.9+220503
Own server or LimeSurvey hosting: Own
Survey theme/template: vanilla
==================
I have an Array type question (QArray), which has 5 columns with the answer codes 1 through 5.
I want to restrict the total number of responses to the column with the answer code "5" to 3 -- that is, no more than 3 options can be rated "5". The sub-questions are coded 1 through 15.
Another way to explain it, column 5 in my array has the heading "High Priority" and then the guidance I give the respondent is: A maximum of 5 responses may be selected as “High Priority” -- and I want to enforce this so that no more than 5 rows can be marked as "high priority"...

Is there a way to do this? 
Last edit: 1 year 10 months ago by blocka.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 10 months ago - 1 year 10 months ago #228059 by Joffm
I should say:
validate like

countif("5",self)<4

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 10 months ago by Joffm.

Please Log in to join the conversation.

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 10 months ago #228060 by blocka
Brilliant -- does the job nicely! From that, I also added a validation text :

{if(countif("5",self)<4,'(A maximum of 3 responses may be selected as High Priority)','You can only select a maximum of 3 High Priority Responses')}

So the respondent knows what's up :-)

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 10 months ago - 1 year 10 months ago #228061 by Joffm
I didn't mention the  validation tip, as you are an experienced user who knows this.
So I only provided the equation.

Regards

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 10 months ago by Joffm.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose