Check out the LimeSurvey source code on GitHub!

Presenting each user with a random subset of questions

3 years 2 months ago #100978 by Tune

I've been trying to use Limesurvey to create a survey where each user is presented with a set of questions that is randomly chosen from a larger set. But I haven't found a way yet. I'm using Limesurvey hosted by and the version is 2.00+

What I want to do is present the user with 40 questions randomly chosen from a larger set of ~200. And the way I thought to do this was to hide the last x number of questions in the survey after they all have been randomised.

What I've tried:
  • I've tried using the question attribute "qseq" in the relevance equations but apparently that variable isn't evaluated until after the relevance equation is evaluated, which makes this approach impossible.
  • Right now I'm trying to use a separate "equation question" to store the "qseq" variable of the previous question (after it has been evaluated), and then use the "equation question" value in the relevance equation of the next question somehow. =)

Is there anyway you know of to accomplish this type of survey structure? (choosing a random subset for each user)

Best Regards

Please Log in to join the conversation.

3 years 1 month ago - 3 years 1 month ago #101662 by Tune
I finally discovered a way to do this without using javascript! =)

Since qseq (and gseq) are not fully determined until after the relevance equation of the same question is evaluated, you have to circumvent this.

This is how you do it:
  1. Create a separate group for each question you plan to have in the survey.
  2. Put all the groups in the same Randomization group.
  3. As the first question (Q1) in each group you should have an Equation question with the group sequential number. Meaning you should write {self.gseq} as the description.
  4. As the second question (Q2) you should have another equation question with a unique value of your choice. This value is used later to identify the question in the response database.
  5. Question 1 & 2 can be set to Always hidden so the participants don't have to see them.
  6. As the third question (Q3) you should have the actual question you want to present to the participants.
  7. The final and very important step is to set the Relevance equation of Q2 & Q3 to "QCODE<N" (without the "), where "QCODE" is the code you chose for question Q1 and "N" is the number of questions that you want presented to each user.
Last Edit: 3 years 1 month ago by Tune.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form