Check out the LimeSurvey source code on GitHub!

Show X Number of Random Answers [from a set]

More
2 years 5 months ago #111177 by ValarMorghulis
Hi,

I am looking to create a question that will display 3 [for arguaments sake] answers but those three answers will be randomly taken from a set of 20 [for arguaments sake] answers. There are no conditions as to what answers are displayed. Is this possible?

If not, is it possible to create a question group with 20 questions and only show one random question from the group per survey?

I cannot seem to find a solution to this in the manual and I would appreciate any help anyone can give me. Thanks in advance!

Please Log in to join the conversation.

More
2 years 5 months ago #111180 by holch
For the first thing you might need some JavaScript. I am thinking about randomizing the question items and hide all after the 3rd, for example. But I don't know how exactly to do this.

Now for the second one, I would create a random number and write it into a open-ended question that is hidden by CSS or Javascript. Then I would write relevance equations like:
hiddenquestion==3

To show or hide the questions based on the random value in the hidden question.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 5 months ago #111182 by ValarMorghulis
Hi holch. Thanks for your answer!

I don't know JavaScript so I'll skip that. I could write the logic for the question in Java but I couldn't write software to match the rest of limesurvey!

I'll go back and read the manual again and I'll have to brush up on my CSS because it has been a while.

Please Log in to join the conversation.

More
2 years 5 months ago #111183 by ValarMorghulis
I thought of another workaround:

Would it be possible to randomise the order of only 5 [for example] question groups and hide the other four after the first is answered but still have other question groups in a specific order?

I don't know if this would work though and if it does, it might be more hassle.

Please Log in to join the conversation.

More
2 years 5 months ago #111187 by tpartner

I am looking to create a question that will display 3 [for arguaments sake] answers but those three answers will be randomly taken from a set of 20 [for arguaments sake] answers.

What question type?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 5 months ago - 2 years 5 months ago #111193 by ValarMorghulis
I have figured it out. I created a random number in a hidden question and then used the relevance equation field. For anybody else who wants to do this:
  • Create a question in the previous question group
  • Insert {randNum(1,5)} into the question text field
  • This will generate a random number between 1 and 5
  • In the advanced options make this question a hidden question
  • Create a new question group
  • Create however many question you want to choose between - in this case 5
  • In the relevence equation field, insert (randNum==x)
  • Replace x with 1,2,3,4 etc.
Last Edit: 2 years 5 months ago by ValarMorghulis. Reason: Forgot step, formatting & marked solved

Please Log in to join the conversation.

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