Welcome to the LimeSurvey Community Forum

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

This may be useful to others - Random pairing with winner stays choice question

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 months 1 week ago #267005 by davebostockgmail
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.68
Own server or LimeSurvey hosting: Own server
Survey theme/template: Custom
==================
Not sure if this will be of use to anyone as it is the first time I have been asked to do this. Basically the researcher wanted a way to display 4 statements in a random order, showing 2 at a time and then the statement that is selected is moved to the next question to be paired with one of the remaining statements, this is then repeated with the final statement.

After looking through previous replies from here I have put together this short survey that carries out this exercise. It is a little bit lengthy (I am sure it can be streamlined) but for now it does what we want.

 

File Attachment:

File Name: limesurvey...3843.lss
File Size:224 KB

 
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 months 1 week ago #267038 by DenisChenu
Unsure i understand it (and i don't look at the survey)

But maybe it can be interesting to have it here : www.limesurvey.org/manual/ExpressionScript_examples/en ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 1 week ago - 3 months 1 week ago #267056 by Joffm
Hi,
I remember that I did something like this some/many years ago.

Is it true that this only works in "question by question"?

I have a different approach.
I use a hidden multiple question (HM) which is used as array filter for the single questions.
After each comparison this hidden question is reset by an equation.

There are only six options to select 2 out of 4 statements
12, 13, 14, 23, 24, 34 (order doesn't matter as we display randomly)
And because the remaing two statements are randomly displayed there are 12 options in total.
1234, 1243, 1324, 1342, 1423, 1432, 2314, 2341, 2413, 2431. 3412, 3421

Now we create a random number (eqRand) (1-12) to select one order in an equation (eqPool)
{if(eqRand==1,'1234', if(eqRand==2,'1243', if(eqRand==3,'1324', if(eqRand==4,'1342', if(eqRand==5,'1423', if(eqRand==6,'1432', if(eqRand==7,'2314', if(eqRand==8,'2341', if(eqRand==9,'2413', if(eqRand==10,'2431', if(eqRand==11,'3412','3421')))))))))))}

The hidden multiple question is set by this equation
{HM_1=if(strpos(join('#',substr(eqPool,0,2)),"1")>0,"Y","")}
{HM_2=if(strpos(join('#',substr(eqPool,0,2)),"2")>0,"Y","")}
{HM_3=if(strpos(join('#',substr(eqPool,0,2)),"3")>0,"Y","")}
{HM_4=if(strpos(join('#',substr(eqPool,0,2)),"4")>0,"Y","")}


The leading "#" to avoid an index of "0" in "strpos"

Q1 now a list(radio) with array filter "HM"

After this qestion HM is reset with this equation
{HM_1=if((substr(eqPool,2,1)=="1") or (Q1==1),"Y","")}
{HM_2=if((substr(eqPool,2,1)=="2") or (Q1==2),"Y","")}
{HM_3=if((substr(eqPool,2,1)=="3") or (Q1==3),"Y","")}
{HM_4=if((substr(eqPool,2,1)=="4") or (Q1==4),"Y","")}


Meaning: If the statement appears on the third place of the string OR if it was selected in Q1, set it.

And the same procedure after this second question
{HM_1=if((substr(eqPool,3,1)=="1") or (Q2==1),"Y","")}
{HM_2=if((substr(eqPool,3,1)=="2") or (Q2==2),"Y","")}
{HM_3=if((substr(eqPool,3,1)=="3") or (Q2==3),"Y","")}
{HM_4=if((substr(eqPool,3,1)=="4") or (Q2==4),"Y","")}


Set the statement at the fourth place and the answer of Q2

Here two examples (for information I show the selected order.
 



And it is rather short
 
 

File Attachment:

File Name: limesurvey...1591.lss
File Size:63 KB

Just another idea.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 months 1 week ago by Joffm.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose