Welcome to the LimeSurvey Community Forum

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

How can I achieve this kind of randomisation? 

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #241841 by Joffm
You can display the images in a different way, which may be better to analyze later-

1. Change these lines in the javascript  (and with tpartner's addition)
$('#question{QID} input[type="text"]:eq(0)').val(arr1);
$('#question{QID} input[type="text"]:eq(1)').val(arr2);


to
$('#question{QID} input[type="text"]:eq(0)').val('#'+arr1).trigger('keyup');
$('#question{QID} input[type="text"]:eq(1)').val('#'+arr2).trigger('keyup');


2a. Create questions for all 24 images at the beginning; all get the same "randomization group name"
2b. Create questions for all 24 images at the end; all get the same "randomization group name", but different from the first one.

3. Now you use the function "strpos" to decide if an image is displayed or not.
So the conditions for images at the beginning are
1st image: strpos(QImage_SQ001,"A")>0
2nd image: strpos(QImage_SQ001,"B")>0
...
12th image: strpos(QImage_SQ001,"L")>0
13th image: strpos(QImage_SQ001,"a")>0
...
24th image: strpos(QImage_SQ001,"l")>0

Only if QImage_SQ001 contains the character the image is displayed.
At the end the same, but with QImage_SQ002.

The advantage is:
Each images is always in the sae column of the database.
Disadvantage:
You waste 24 columns.

Why did I add the '#' at the beginning?
Without this, the result of "strpos(QImage_SQ002,"H")" - using the distribution of the previous screenshot - would be "0" (the function starts at "0")
But unfortunately "strpos(QImage_SQ002,"X")" also returns "0". Here it means "not found".

Therefore I make sure that the first valid index is "1".

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • AurélienULB
  • AurélienULB's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #241887 by AurélienULB
Replied by AurélienULB on topic How can I achieve this kind of randomisation? 
Hello everyone ! Thank you for your answers ! 

The problem with your solution is that we cannot use "multiple short text" as we are working with slider values. Will it work with the same code? I linked the group of questions as you suggested, so you can see what we are working with. 

We are new to limesurvey and don't know much about coding, so I thank you very much for your patience ! 
 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #241900 by holch
Always provide LSS files, not LSG or LSQ (except if specificially requested).

Why? Because it is a lot more work for the volunteer helpers in the forum, who do this in their spare time.

A LSS file can be just imported and is ready. Now for LSG and LSQ files we need to first create a survey, hope that it is in the correct base language. And it is also lacking all the other survey wide settings that might have an impact.

Help us to help you.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago - 2 years 1 month ago #241902 by Joffm
As @holch.
but these are conditons/relevance equations on question/group level.

So the type of questions is irrelevant.

Send a lss export.

Joffm 

I had a look at your "lsg".
And:
You did not insert the question "QImage" with the javascript snippet.
I called it QImage because you talked about "images"

I have a group of questions that contains 24 images divided into two conditions: 12 images belonging to condition 1 and 12 images belonging to condition

Your questions do not have a "randomization group name"

2a. Create questions for all 24 images at the beginning; all get the same "randomization group name"
2b. Create questions for all 24 images at the end; all get the same "randomization group name", but different from the first one.


Your questions do not have a "relevance equation" or "condition" (the wording differs in LS versions)

3. Now you use the function "strpos" to decide if an image is displayed or not.
So the conditions for images at the beginning are
1st image: strpos(QImage_SQ001,"A")>0
2nd image: strpos(QImage_SQ001,"B")>0

Do it and send this lss.



 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 1 month ago by Joffm.

Please Log in to join the conversation.

  • AurélienULB
  • AurélienULB's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #242031 by AurélienULB
Replied by AurélienULB on topic How can I achieve this kind of randomisation? 
Hello Joffm, 

Thank you for your reply, 

Here is the lss file. 

I did what you suggested: 

- A different "randomization group name" for the questions at the beginning and at the end. 
- Insert the javascript snippet for the two first qestions named "ATT1" and "ATT2" - is it correctly done? 
I want to be sure that I'm modifying the rights things before applying it to all the questions..

Where do I have to apply the "strpos" function exactly?

Thank you for your time, 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago - 2 years 1 month ago #242035 by Joffm
Hi,
I assume that Scalar 1 and Scalar 2 are the interesting groups.

So, you still did not
You did not insert the question "QImage" with the javascript snippet.
I wrote

In a question of type "multiple short text" (QImage) insert this javascript snippet

NOT in the questions you want to filter. Best you insert it into your first group.

Your questions do not have a "randomization group name". 
ALL questions of the group get this name. I think you want to display them in random order.

Where do I have to apply the "strpos" function exactly?

Your questions do not have a "relevance equation" or "condition" (the wording differs in LS versions)

3. Now you use the function "strpos" to decide if an image is displayed or not.
So the conditions for images at the beginning are
1st image: strpos(QImage_SQ001,"A")>0

 

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 1 month ago by Joffm.

Please Log in to join the conversation.

  • AurélienULB
  • AurélienULB's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #242284 by AurélienULB
Replied by AurélienULB on topic How can I achieve this kind of randomisation? 
Dear Joffm,

Thank you for helping me out again, and sorry for the delay in my response, I had to ask my supervisors for helping with the LimeSurvey changes... 

File Attachment:

File Name: limesurvey...8622.lss
File Size:619 KB


*I did now inserted the javascript snippet (with tpartner's addition) in a multiple short text question named "QImagesc1" and "QImagesc2" for both question groups "GeoCatScalar1" and "GeoCatScalar2". However, I'm not sure if the code is in the appropriate location: I've inserted it as a source code in the question itself and I get only one line and not two (see screenshot).

*I now have the same randomization groupe name (scalar1) for all questions of 'GeoCatScalar1' and a different randomization group name (scalar2) for all questions of 'GeoCatScalar2'.

*I also have inserted the function "strpos" as you suggested. For the images of my first condition (ATT1, ATT2, ATT3, ... ATT12), I did inserted the strpos function beginning with : (QImage_SQ001, "A")>0, and ending with : (QImage_SQ001, "L")>0. For the images of my second condition (REL1, REL2, REL3, ..., REL12) I did the same as above, but with small letters : (QImage_SQ002, "a")>0.

*You also said that I had to rename my images to 'ImageA.jpg', 'Imagea.jpg' etc. I didn't mention it at the beginning but each of our items is composed of two images. For the first item for example, should I then rename my two images to 'ImageA.jpg'?

Thank you for your patience,

Best wishes, Aurélien

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #242286 by Joffm
Hi, 
Where is the lss export?
You still do not understand what you have to do.

And my first proposal - tayloring the images - is not used anymore.

Now you have a fixed question for each image, meaning the name of images are up to you.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #242312 by LolaTx
Dear Joffm, 

I will take the lead from here, I am a PhD student and I am supervising Aurélien in the creation of his questionnaire. Unfortunately we are not at all familiar with this type of randomisation, nor with coding so thank you for your patience!

Please find the Iss export in the attached files. 

When we preview our survey, we are presented with all 24 items of our 'GeoCatScalar1' question-group. However, we added (1) the javascript snippet code as suggested, (2) a specific randomization group name for all 24 items of 'GeoCatScalar1, and (3) the strpos functions for each item. 

Best regards, 
Lola
 
 
Last edit: 2 years 1 month ago by LolaTx.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #242322 by Joffm
Hi,
1. You did not insert the question "QImage" with the javascript snippet.
Instead you inserted two questions "QImagesc1" and "QImagesc2" which you never use.
Your relevance equation is still "strpos(QImage_SQ001,"A")>0"
And this question did not have two subquestions.
Create this question in the first qroup.

Here you only shuffle the 24 elements into two containers.
You need two subquestions. I showed it here
 
Later you use them for the relevance equation.


2. Furthermore you will get in trouble because you display "question by question"
You cant'hide the question by "Always hide this question".
Then the whole question is not existing in the DOM and there is no javascript to work.
Therefore you see the line in the script
    // Remove the slashes in the next line 
//    $('#question{QID}').hide();

While you test the survey you shouldn't hide it, but in the real survey you should by removing the slashes.

Now the inconvenience.
The question is hidden after it is displayed on the screen. So you see "nothing but the "Previous" and "Next" button.
A possible workaround is to hide the question by css (css class "hidden") and as soon as the javascript worked you trigger the "Next" button.

To avoid this we often recommend to display "group by group" with only one question per group.
This way you are able to use some workarounds and you also can display two questions one page.

Well, I restructured your survey.
But I did not add the missing relevance equations in "GeoCatScalar", the second.
Of course here you enter the condition that the character is included in the second "container", subquestion.
"strpos(QImage_SQ002,"A")>0
 

File Attachment:

File Name: limesurvey...4862.lss
File Size:586 KB


And I do not talk about the missing filters "autrelang", the - in my opinion - bad idea to use a dropdown question if there are only two or three options "genre", "autrelang", "paysetude". You may use bootstrap-buttons instead.

The spacings in the GeoCat questions are different in the questions.

And you should revise the css of the texts. Did you copy it from somewhere?
Real orgias of <span>.

And do you really expect people to answer the 60 items of listedemots? 

File Attachment:

File Name: limesurvey...4862.lss
File Size:586 KB

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 years 1 month ago #242354 by LolaTx
Dear Joffm, 

We are very grateful for the time you invested to help us with our questionnaire ! Thanks to you, our survey runs perfectly now ! 

According to your suggestions, we now also have modified our demographic questions into bootstrap buttons. I have a last questions, we want our participants to be redirected to the end of the questionnaire if they are not at least 18 (question 'age') or if their level of French is below 5 (question 'nivfr'). We were used to set conditions and apply these conditions to all other groups of questions in the questionnaire. But perhaps this approach will conflict with our 'strpos'-conditions ? 

I don't understand what you mean with "you should revise the css of the texts. Did you copy it from somewhere? Real orgias of <span>". Does this have anything to do with the fonts we use ? 

Yes, we expect our participants to answer to all 60 items of 'listesdemots'. I agree that this is a lot but this tool was developed by my PhD supervisor... :-)

Thank you again, best wishes, 
Lola
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #242356 by Joffm
To screen out people you should use quotas, in your case with limiot "0".
[url] www.limesurvey.org/manual/Survey_quotas/en [/url]

And I talked about these things.
Code:
<p style="text-align: center;"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Il vous sera maintenant demandé d'indiquer sur une échelle continue</font></font></font></font></font></font></font></font></font></font></font></font></span></span></p>
 
<p style="text-align: center;"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">à quel point deux figures sont </font></font></font></font></font></font></font></font></font></font><u><strong><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">similaires</font></font></font></font></font></font></font></font></font></font></strong></u><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> entre elles.</font></font></font></font></font></font></font></font></font></font></font></font></span></span></p>
 
<p style="text-align: center;"> </p>
 
<p style="text-align: center;"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Pour cela, il vous suffira de déplacer le curseur vers la gauche</font></font></font></font></font></font></font></font></font></font></font></font></span></span></p>
 
<p style="text-align: center;"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">ou vers la droite selon votre réponse.</font></font></font></font></font></font></font></font></font></font></font></font></span></span></p>
This is the source code of the text. Rather terrible.
But this one I revised in the survey I sent back.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: LolaTx

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose