- Posts: 13
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Randomly show X out of Y question groups
- globetrotter
- Topic Author
- Offline
- New Member
Less
More
5 years 6 months ago #174269
by globetrotter
Randomly show X out of Y question groups was created by globetrotter
Hello world,
I try to select randomly 5 out of 10 question groups. I have already found this solution here manual.limesurvey.org/Workarounds:_Surve...of_Y_question_groups
but I don't get along with this. Could you please help me by giving me more detailed information how to implement this in my survey? I use Limesurvey version 2.05 and I absolutely don't know how to use JavaScript. Maybe it is possible to send me some photos where exactly I have to fill in the codes and the other tools?
Thanks a lot for your help!
I try to select randomly 5 out of 10 question groups. I have already found this solution here manual.limesurvey.org/Workarounds:_Surve...of_Y_question_groups
but I don't get along with this. Could you please help me by giving me more detailed information how to implement this in my survey? I use Limesurvey version 2.05 and I absolutely don't know how to use JavaScript. Maybe it is possible to send me some photos where exactly I have to fill in the codes and the other tools?
Thanks a lot for your help!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
5 years 6 months ago #174276
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Randomly show X out of Y question groups
Well, the idea of this workaround is:
You have e.g. 6 groups of questions (group in the meaning of LimeSurvey)
you want to show only two of them selected randomly.
Therefore you create a question of type "multiple" (with questioncode "M1") at the start with (in our example) 6 subquestions.
Now the script:
This is inserted in the question code (in source code mode)
This script checks two subquestions at random, or whatever number you enter in "showNumberOfGroups".
In the relevance equation of your groups you enter:
1st group: M1_SQ001=="Y"
2nd group: M1_SQ002=="Y"
3rd group: M1_SQ003=="Y"
...
Okay, this is the idea of this workaround, I did not test it, because I do not have such an old version.
Joffm
You have e.g. 6 groups of questions (group in the meaning of LimeSurvey)
you want to show only two of them selected randomly.
Therefore you create a question of type "multiple" (with questioncode "M1") at the start with (in our example) 6 subquestions.
Now the script:
This is inserted in the question code (in source code mode)
This script checks two subquestions at random, or whatever number you enter in "showNumberOfGroups".
In the relevance equation of your groups you enter:
1st group: M1_SQ001=="Y"
2nd group: M1_SQ002=="Y"
3rd group: M1_SQ003=="Y"
...
Okay, this is the idea of this workaround, I did not test it, because I do not have such an old version.
manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurveywhere exactly I have to fill in the codes
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- globetrotter
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
- Thank you received: 0
5 years 6 months ago #174279
by globetrotter
Replied by globetrotter on topic Randomly show X out of Y question groups
I did fill in what you wrote to me, thanks for your explanations! However the random function doesn't work.
Do I have to leave out this "<script>" at the beginning and at the end of the code?
Do I have to fill in sth in the answer options?
Do I have to leave out this "<script>" at the beginning and at the end of the code?
Do I have to fill in sth in the answer options?
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 6 months ago #174288
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Randomly show X out of Y question groups
You better export your Survey as LSS and attach it here. That way Joffm might be able to spot the issue in your survey.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
5 years 6 months ago #174314
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Randomly show X out of Y question groups
Hi,
here a sample.
Created in 2.06.
Joffm
here a sample.
Created in 2.06.
Joffm
Please refer to the link I provided?Do I have to leave out this "<script>" at the beginning and at the end of the code?
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 6 months ago #174346
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Randomly show X out of Y question groups
More simple with
gitlab.com/SondagesPro/addScriptToQuestion
and stable too (admin user can, update, user with xss can not update, but this not destroy value when saving )
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- globetrotter
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
- Thank you received: 0
5 years 6 months ago #174368
by globetrotter
Replied by globetrotter on topic Randomly show X out of Y question groups
Thanks for your file! Do I get it right that I have to fill in this code in every question group at the beginning in a question (and then my normal questions will follow)? Or is it enough to create only one multiple question with this code?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 6 months ago #174414
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 Randomly show X out of Y question groups
Maybe a solution like this to randomly display n out of x groups -
www.limesurvey.org/forum/can-i-do-this-w...estion-groups#145950
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- globetrotter
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
- Thank you received: 0
5 years 6 months ago #174435
by globetrotter
Replied by globetrotter on topic Randomly show X out of Y question groups
Thanks for your solution! I used the information in your link and 5 out of 10 question groups are shown. However my randomization doesn't work. I wrote down randgroup1, randgroup2... but do I have to change another thing or button anywhere?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 6 months ago #174442
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 Randomly show X out of Y question groups
All groups that you want randomized together should have the same randomization name.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- globetrotter
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
- Thank you received: 0
5 years 6 months ago #174453
by globetrotter
Replied by globetrotter on topic Randomly show X out of Y question groups
Ok I changed it and understand what you mean. But now always the question after the equtionquestion is hidden. Maybe there is a problem because I set some conditions to other question groups. Could you please have a look at this extract?
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 6 months ago #174455
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 Randomly show X out of Y question groups
I'm sorry, I cannot test on such an old version. As Denis says, there may be bugs in that version.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.