- Posts: 114
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
appear randomly and arranged them in random order
- RitaShen
- Topic Author
- Offline
- Premium Member
Less
More
1 year 1 month ago - 1 year 1 month ago #241077
by RitaShen
appear randomly and arranged them in random order was created by RitaShen
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.8
Own server or LimeSurvey hosting:LimeSurvey hosting
Survey theme/template: bootswatch
==================
Hi there,
If I have 10 pictures, but I just want to appear 8 of 10 pictures randomly, but also those 8 pictures need to appear in random order.
(randomly pick 8 sets of paired profiles out of all the 10 possible sets and arranged them in random order)
How could I present or what could I do?
Thank you in advance
Your LimeSurvey version: 5.6.8
Own server or LimeSurvey hosting:LimeSurvey hosting
Survey theme/template: bootswatch
==================
Hi there,
If I have 10 pictures, but I just want to appear 8 of 10 pictures randomly, but also those 8 pictures need to appear in random order.
(randomly pick 8 sets of paired profiles out of all the 10 possible sets and arranged them in random order)
How could I present or what could I do?
Thank you in advance
Last edit: 1 year 1 month ago by RitaShen.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
1 year 1 month ago - 1 year 1 month ago #241079
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic appear randomly and arranged them in random order
Hi, Rita,
you may use this javascript to select the 8 out of 10
Insert it into a question of type "shorttext" (eqImage)
You will get something like #CEFAHBDJ
Your questions all get the same randomozation group name and the conditions
strpos(eqImage,"A")>0
strpos(eqImage,"B")>0
...
Joffm
you may use this javascript to select the 8 out of 10
Insert it into a question of type "shorttext" (eqImage)
Code:
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the array var arr = ["A","B","C","D","E","F","G","H","I","J"]; // Shuffle the array arr = shuffle(arr); anumbers = arr.slice(0,8).join(''); $('#question{QID} input[type="text"]').val('#'+anumbers); $('#question{QID}').hide(); }); </script>
You will get something like #CEFAHBDJ
Your questions all get the same randomozation group name and the conditions
strpos(eqImage,"A")>0
strpos(eqImage,"B")>0
...
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 1 month ago by Joffm.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
1 year 1 month ago - 1 year 1 month ago #241081
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic appear randomly and arranged them in random order
Or you use the property ".gseq"
Joffm
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 1 month ago by Joffm.
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
1 year 1 month ago #241082
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 appear randomly and arranged them in random order
Hi @Joofm : why not 10 Dispaly text question (with the picture) in same random group and 2 in a «hidden» group ?
Denis
Denis
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.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3964
1 year 1 month ago #241084
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic appear randomly and arranged them in random order
Because this obvious way to do it didn't come to my mind this morning. I am an old man.
Maybe I was a bit confused about it because
Joffm
Maybe I was a bit confused about it because
So I thought there might be more than one question in a group.(randomly pick 8 sets of paired profiles out of all the 10 possible sets and arranged them in random order)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
1 year 1 month ago #241088
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 appear randomly and arranged them in random order
It all comes down to how these 8 images should be presented. If they should be presented in one question it is different to 8 out of 10 questions with different pictures.
So I think we need some more information from OP about how the images should be presented in the first place.
So I think we need some more information from OP about how the images should be presented in the first place.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu
Please Log in to join the conversation.