Welcome to the LimeSurvey Community Forum

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

Show X Number of Random Answers [from a set]

More
11 years 10 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!
The topic has been locked.
More
11 years 10 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:
Code:
hiddenquestion==3

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

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
More
11 years 10 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.
The topic has been locked.
More
11 years 10 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.
The topic has been locked.
More
11 years 10 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.
The topic has been locked.
More
11 years 10 months ago - 11 years 10 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: 11 years 10 months ago by ValarMorghulis. Reason: Forgot step, formatting & marked solved
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose