- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Customizing questions randomly and systematically
- Martin Jönsson
- Topic Author
- Offline
- New Member
Less
More
11 months 3 weeks ago #242990
by Martin Jönsson
Customizing questions randomly and systematically was created by Martin Jönsson
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 5.6.14
Own server or LimeSurvey hosting: Lime Survey hosting
Survey theme/template: Not sure
==================
Hi,
I'm new to Lime Survey and I need some help with how I adapt a question in a certain way so that different recipients see different questions. The survey I have in mind will contain 16 different questions each corresponding to a certain skeleton. When presented to a respondent each skeleton will have been fleshed on either by randomly assigning certain phrases to it or by systematically assigning certain phrases to it depending on which respondent is respondent.
Here is an illustration of (a part of) the skeloton for one question I have in mind
"X dislikes members of the Y minority, although he has had little personal experience interacting with them. Moreover, he believes that they Z".
Where X and Y are randomly fleshed out by picking names from two different lists each containing 16 names, and Z is determined by picking the nth entry on a list 16 entries where for the nth participant (so the first participant is given the first item, the second participant is given the second item etc).
All questions will be answered in the same way (on a scale from 1-7)
This is likely very basic but despite it being so I failed to find the information on my own. I'm very grateful for your help.
Your LimeSurvey version: LimeSurvey Cloud Version 5.6.14
Own server or LimeSurvey hosting: Lime Survey hosting
Survey theme/template: Not sure
==================
Hi,
I'm new to Lime Survey and I need some help with how I adapt a question in a certain way so that different recipients see different questions. The survey I have in mind will contain 16 different questions each corresponding to a certain skeleton. When presented to a respondent each skeleton will have been fleshed on either by randomly assigning certain phrases to it or by systematically assigning certain phrases to it depending on which respondent is respondent.
Here is an illustration of (a part of) the skeloton for one question I have in mind
"X dislikes members of the Y minority, although he has had little personal experience interacting with them. Moreover, he believes that they Z".
Where X and Y are randomly fleshed out by picking names from two different lists each containing 16 names, and Z is determined by picking the nth entry on a list 16 entries where for the nth participant (so the first participant is given the first item, the second participant is given the second item etc).
All questions will be answered in the same way (on a scale from 1-7)
This is likely very basic but despite it being so I failed to find the information on my own. I'm very grateful for your help.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
11 months 3 weeks ago #242991
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Customizing questions randomly and systematically
Hi,
it is not so very clear to me.
I understand that you ask 16 questions
X and Y are taken from two list, each containing 16 items,; the items are randomly distributed over the 16 questions (of course, unique)
Now there is a third list (also containing 16 items?)
The first respondent sees the first item, the second the second, and so on.
If this is correct you can solve this with a small javascript snippet for X and Y, and the SAVEDID for Z.
As usual the best is, you provide your approach as lss export, the second best, show it with a sketch or a simple example of three ot four questions (how do the lists look like, what die you expect?)
Joffm
it is not so very clear to me.
I understand that you ask 16 questions
X and Y are taken from two list, each containing 16 items,; the items are randomly distributed over the 16 questions (of course, unique)
Now there is a third list (also containing 16 items?)
The first respondent sees the first item, the second the second, and so on.
If this is correct you can solve this with a small javascript snippet for X and Y, and the SAVEDID for Z.
As usual the best is, you provide your approach as lss export, the second best, show it with a sketch or a simple example of three ot four questions (how do the lists look like, what die you expect?)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Martin Jönsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
11 months 3 weeks ago #242995
by Martin Jönsson
Replied by Martin Jönsson on topic Customizing questions randomly and systematically
Hi Joffm, wrote:
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
11 months 3 weeks ago - 11 months 3 weeks ago #242996
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Customizing questions randomly and systematically
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 11 months 3 weeks ago by Joffm.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
11 months 3 weeks ago - 11 months 3 weeks ago #243017
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Customizing questions randomly and systematically
Hi,
do you wish something like this?
Random selection of X and Y, but a constant Z
And the next participant gets the next Z
Joffm
do you wish something like this?
Random selection of X and Y, but a constant Z
And the next participant gets the next Z
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 11 months 3 weeks ago by Joffm.
Please Log in to join the conversation.
- Martin Jönsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
11 months 3 weeks ago #243030
by Martin Jönsson
Replied by Martin Jönsson on topic Customizing questions randomly and systematically
Yes, that's pretty close. Except that the variables are replaced by words and phrases in three separate lists wrote:
Please Log in to join the conversation.
- Martin Jönsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
11 months 3 weeks ago #243031
by Martin Jönsson
Replied by Martin Jönsson on topic Customizing questions randomly and systematically
Yes, that's pretty close. Except that the variables are replaced by words and phrases in three separate lists
So instead of
“X13 dislikes members of the y7 minority, although he has had little personal experience with them. Moreover, he believes that they Z5”
It will be
“John dislikes members of the Arawa minority although he has had little personal experience with them. Moreover, he believes that they are unkind towards strangers.”
Where
“john” is the 13th entry in a list of names
“Arawa” is the 7th entry in a list of nonsense words for minorities and
“are unkind to strangers” is the 5th entry in a list of phrases.
Thanks so much for taking the time to help me with this. I really appreciate it. I tried responding yesterday with a lengthy clarification but it was all lost when I tried to submit it (same thing happened today so I must be misunderstanding the quote option here)
So instead of
“X13 dislikes members of the y7 minority, although he has had little personal experience with them. Moreover, he believes that they Z5”
It will be
“John dislikes members of the Arawa minority although he has had little personal experience with them. Moreover, he believes that they are unkind towards strangers.”
Where
“john” is the 13th entry in a list of names
“Arawa” is the 7th entry in a list of nonsense words for minorities and
“are unkind to strangers” is the 5th entry in a list of phrases.
Thanks so much for taking the time to help me with this. I really appreciate it. I tried responding yesterday with a lengthy clarification but it was all lost when I tried to submit it (same thing happened today so I must be misunderstanding the quote option here)
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
11 months 3 weeks ago #243034
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Customizing questions randomly and systematically
This is exactly what I showed.
As I don't know your exact phrases, all are only placeholders, e.g. X7 the seventh entry of list X.
Later I'll send an lss.
At the moment I answer from my smartphone.
As I don't know your exact phrases, all are only placeholders, e.g. X7 the seventh entry of list X.
Later I'll send an lss.
At the moment I answer from my smartphone.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
11 months 3 weeks ago - 11 months 3 weeks ago #243035
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Customizing questions randomly and systematically
As promised a sample survey.
In group "GPool" I created a question (Q0) of type array(text) with two columns (X & Y) and 17 rows (16 for the randomly chosen X- and Y-values, 1 for the constant Z-value)
In this question I inserted this script
You will get this
Now you pipe the values into your questions, like
{Q0_Y001_X001} dislikes members of the {Q0_Y001_X002} minority, although he has had little personal experience interacting with them. Moreover, he believes that they {Q0_Z001_X001}
{Q0_Y002_X001} dislikes members of the {Q0_Y002_X002} minority, although he has had little personal experience interacting with them. Moreover, he believes that they {Q0_Z001_X001}
and so on.
The lss
And remember: SAVEDID is only available in active surveys.
Generally I do not see any advantage of this cyclic selection (remember: drop-outs) over a simple selection by random number.
Joffm
Joffm
In group "GPool" I created a question (Q0) of type array(text) with two columns (X & Y) and 17 rows (16 for the randomly chosen X- and Y-values, 1 for the constant Z-value)
In this question I inserted this script
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 arrays var arrX = ["Adam", "Bert", "Carol", "Deborah", "Esther", "Frank", "George", "Henry", "Iris", "Jacob", "Ken", "Larry", "Michael", "Noemi", "Ottilie", "Paula" ]; var arrY = ["Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7", "Y8", "Y9", "Y10", "Y11", "Y12", "Y13", "Y14", "Y15", "Y16" ]; var arrZ = ["Z1", "Z2", "Z3", "Z4", "Z5", "Z6", "Z7", "Z8", "Z9", "Z10", "Z11", "Z12", "Z13", "Z14", "Z15", "Z16" ]; //Shuffle arrays X and Y arrX = shuffle(arrX); arrY = shuffle(arrY); //Fill the LimeSurvey array $('#question{QID} tr[id^="javatbd"]:eq(0) input[type="text"]:eq(0)').val(arrX[0]); $('#question{QID} tr[id^="javatbd"]:eq(1) input[type="text"]:eq(0)').val(arrX[1]); $('#question{QID} tr[id^="javatbd"]:eq(2) input[type="text"]:eq(0)').val(arrX[2]); $('#question{QID} tr[id^="javatbd"]:eq(3) input[type="text"]:eq(0)').val(arrX[3]); $('#question{QID} tr[id^="javatbd"]:eq(4) input[type="text"]:eq(0)').val(arrX[4]); $('#question{QID} tr[id^="javatbd"]:eq(5) input[type="text"]:eq(0)').val(arrX[5]); $('#question{QID} tr[id^="javatbd"]:eq(6) input[type="text"]:eq(0)').val(arrX[6]); $('#question{QID} tr[id^="javatbd"]:eq(7) input[type="text"]:eq(0)').val(arrX[7]); $('#question{QID} tr[id^="javatbd"]:eq(8) input[type="text"]:eq(0)').val(arrX[8]); $('#question{QID} tr[id^="javatbd"]:eq(9) input[type="text"]:eq(0)').val(arrX[9]); $('#question{QID} tr[id^="javatbd"]:eq(10) input[type="text"]:eq(0)').val(arrX[10]); $('#question{QID} tr[id^="javatbd"]:eq(11) input[type="text"]:eq(0)').val(arrX[11]); $('#question{QID} tr[id^="javatbd"]:eq(12) input[type="text"]:eq(0)').val(arrX[12]); $('#question{QID} tr[id^="javatbd"]:eq(13) input[type="text"]:eq(0)').val(arrX[13]); $('#question{QID} tr[id^="javatbd"]:eq(14) input[type="text"]:eq(0)').val(arrX[14]); $('#question{QID} tr[id^="javatbd"]:eq(15) input[type="text"]:eq(0)').val(arrX[15]); $('#question{QID} tr[id^="javatbd"]:eq(0) input[type="text"]:eq(1)').val(arrY[0]); $('#question{QID} tr[id^="javatbd"]:eq(1) input[type="text"]:eq(1)').val(arrY[1]); $('#question{QID} tr[id^="javatbd"]:eq(2) input[type="text"]:eq(1)').val(arrY[2]); $('#question{QID} tr[id^="javatbd"]:eq(3) input[type="text"]:eq(1)').val(arrY[3]); $('#question{QID} tr[id^="javatbd"]:eq(4) input[type="text"]:eq(1)').val(arrY[4]); $('#question{QID} tr[id^="javatbd"]:eq(5) input[type="text"]:eq(1)').val(arrY[5]); $('#question{QID} tr[id^="javatbd"]:eq(6) input[type="text"]:eq(1)').val(arrY[6]); $('#question{QID} tr[id^="javatbd"]:eq(7) input[type="text"]:eq(1)').val(arrY[7]); $('#question{QID} tr[id^="javatbd"]:eq(8) input[type="text"]:eq(1)').val(arrY[8]); $('#question{QID} tr[id^="javatbd"]:eq(9) input[type="text"]:eq(1)').val(arrY[9]); $('#question{QID} tr[id^="javatbd"]:eq(10) input[type="text"]:eq(1)').val(arrY[10]); $('#question{QID} tr[id^="javatbd"]:eq(11) input[type="text"]:eq(1)').val(arrY[11]); $('#question{QID} tr[id^="javatbd"]:eq(12) input[type="text"]:eq(1)').val(arrY[12]); $('#question{QID} tr[id^="javatbd"]:eq(13) input[type="text"]:eq(1)').val(arrY[13]); $('#question{QID} tr[id^="javatbd"]:eq(14) input[type="text"]:eq(1)').val(arrY[14]); $('#question{QID} tr[id^="javatbd"]:eq(15) input[type="text"]:eq(1)').val(arrY[15]); // Capture the SAVEDID var id={SAVEDID}; id=(id-1) % 16; // Fill the last field of the LimeSurvey array with the calculated index $('#question{QID} tr[id^="javatbd"]:eq(16) input[type="text"]:eq(0)').val(arrZ[id]); // Remove the slashes to hilde the question after test // $('#question{QID}').hide(); }); </script>
You will get this
Now you pipe the values into your questions, like
{Q0_Y001_X001} dislikes members of the {Q0_Y001_X002} minority, although he has had little personal experience interacting with them. Moreover, he believes that they {Q0_Z001_X001}
{Q0_Y002_X001} dislikes members of the {Q0_Y002_X002} minority, although he has had little personal experience interacting with them. Moreover, he believes that they {Q0_Z001_X001}
and so on.
The lss
And remember: SAVEDID is only available in active surveys.
Generally I do not see any advantage of this cyclic selection (remember: drop-outs) over a simple selection by random number.
Joffm
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 11 months 3 weeks ago by Joffm.
Please Log in to join the conversation.
- Martin Jönsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
11 months 3 weeks ago #243137
by Martin Jönsson
Replied by Martin Jönsson on topic Customizing questions randomly and systematically
Thank you so much for this. This is perfect!
Please Log in to join the conversation.