- Posts: 4
- Thank you received: 0
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]
- ValarMorghulis
- Topic Author
- Offline
- New Member
Less
More
9 years 7 months ago #111177
by ValarMorghulis
Show X Number of Random Answers [from a set] was created 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!
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.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
9 years 7 months ago #111180
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Show X Number of Random Answers [from a set]
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:
To show or hide the questions based on the random value in the hidden question.
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.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- ValarMorghulis
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
9 years 7 months ago #111182
by ValarMorghulis
Replied by ValarMorghulis on topic Show X Number of Random Answers [from a set]
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.
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.
- ValarMorghulis
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
9 years 7 months ago #111183
by ValarMorghulis
Replied by ValarMorghulis on topic Show X Number of Random Answers [from a set]
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.
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.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
9 years 7 months ago #111187
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Show X Number of Random Answers [from a set]
What question type?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.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- ValarMorghulis
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
9 years 7 months ago - 9 years 7 months ago #111193
by ValarMorghulis
Replied by ValarMorghulis on topic [Solved] Show X Number of Random Answers [from a set]
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: 9 years 7 months ago by ValarMorghulis. Reason: Forgot step, formatting & marked solved
The topic has been locked.