Welcome, Guest
Username: Password: Remember me

TOPIC: Show X Number of Random Answers [from a set]

Show X Number of Random Answers [from a set] 2 months 5 days ago #111177

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 administrator has disabled public write access.

Show X Number of Random Answers [from a set] 2 months 5 days ago #111180

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2719
  • Thank you received: 331
  • Karma: 121
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.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Show X Number of Random Answers [from a set] 2 months 5 days ago #111182

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 administrator has disabled public write access.

Show X Number of Random Answers [from a set] 2 months 5 days ago #111183

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 administrator has disabled public write access.

Show X Number of Random Answers [from a set] 2 months 4 days ago #111187

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

[Solved] Show X Number of Random Answers [from a set] 2 months 4 days ago #111193

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 months 4 days ago by ValarMorghulis. Reason: Forgot step, formatting & marked solved
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.161 seconds
Donation Image