Welcome to the LimeSurvey Community Forum

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

Randomly display question groups based on checked checkboxes in Array (Numbers)

  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago #200059 by syssecsurvey
Hi,

I have an Array (Numbers)-type question in checkbox layout. For each subquestion, participants are asked to mark whether certain criteria apply. The survey is then supposed to a) determine for which subquestions the participant has checked specific columns in that array and b) randomly select 3 of these subquestions, based on which the participant will later be shown a specific question group with questions.

I attached a sample survey that looks like this:

Q1 [foodselector1]: Which of the following foods have you eaten last week?
[ ] Pastries
[ ] Chocolate
[ ] Fruit
[ ] Cake

(This question just serves as the array filter for Q2 so people don't have to make up their minds about subquestions they don't have much to say about.)

Q2 [foodselector2]: Please indicate where you have recently bought each of the following foods.

X axis: Grocery store, specialized store, convenience store, I have not bought this food recently, Prefer not to say
Y axis: [Foods the participant has selected in Q1]

Now I would like to determine for which foods the participant has selected "grocery store" or "specialized store" and randomly select n of these foods. Each of the foods has its own question group and the participant is supposed to only see the question groups for the foods randomly drawn in the previous step. (n is supposed to be an upper bound, so if less than n subquestions match these criteria, fewer question groups are supposed to be displayed, and none in case no food was bought at a grocery store or convenience store). Some of the questions in the question groups need to check which columns were ticked in Q2 for the respective food item.

So can I do this in LimeSurvey (I'm sure I can) and what would be the best way to achieve this?
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200070 by Joffm
Hi,

Display all food groups by relevance equation like (Q2_SQ001<3)
with "1" and "2" the codes of "grocery store" and "specialized store".
So I just can say, it's less than 3.
With your "codes" it's a bit more complicated.

Randomize these groups by the "Randomization group name"
Limit the groups by "Qcode.gseq" like
favoritechocolate.gseq<2

Remeber: gseq is the sequential group number starting by 0; so you have to adapt the value

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago #201704 by syssecsurvey
Thanks for this great yet simple idea (and sorry for the late response)! I just tried doing that, but somehow I already fail at correctly addressing the subquestions in the Array (Numbers) question.

I have assigned each column in the array a numeric question code from 3 to 0 (no idea if LimeSurvey will treat these as strings or numbers).
Then I try to create the relevance equation as suggested in your post, using the questioncode_subquestioncode format as before. But when I check the survey logic for this group, I get an error telling me that this subquestion does not exist (but it really does). If I change this to another question / subquestion combination, the error disappears. What am I doing wrong? Is there a specific way to address the subquestions in an Array (Numbers) question?
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago #201718 by syssecsurvey
Just figured it out myself from the sample survey below - apparently the syntax is questioncode_yaxiscode_xaxiscode.
manual.limesurvey.org/ExpressionScript_e...Checkbox.22_question
The topic has been locked.
  • syssecsurvey
  • syssecsurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago #201875 by syssecsurvey
I'm now almost done implementing this, the only thing I'm having problems with right now is the part that limits the number of displayed question groups. Where am I supposed to put the .gseq part? I tried putting it into the relevance field for one of the question groups in my randomized set, but apparently gseq is a property of a question and not of a question group, so I get an error that this value does not exist.


Also, is there a way to display / hide a question group based on whether an existing question group has been displayed?
The topic has been locked.
More
3 years 10 months ago #201878 by jelo

syssecsurvey wrote: Also, is there a way to display / hide a question group based on whether an existing question group has been displayed?

That can be checked via the relevance status.

Take a look at this example, where the task is to show a selection of groups.
forums.limesurvey.org/forum/can-i-do-thi...lect-question-groups

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose