Welcome to the LimeSurvey Community Forum

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

How to randomly show questions under previous random restrictions?

  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 months ago - 3 years 3 months ago #225511 by xueting
Hi Joffm,
The cyclist allocation works well so far, thanks to your instruction.
But there is one confusion regarding to the unlimited issue, may I ask for your help please? Thanks!

The thing is now the following equation is used, and the list just can cover limited respondents, as many as the number of rows in the list, e.g. if 500 sample is needed, seems the list should be copied to over 500 rows at least. 

Equation: {substr(latin,(SAVEDID-1)*10,8)}

latin’ = question where list as the default answer

By the way, just make sure that the condition for the equation to be true is that a newline character is equal to two characters right?

And the sequence is showed in the following table:
 

It should be fine that copying enough rows in the list, but just curious about the unlimited issue.

To make it become unlimited, I created another equation‘row’refering to your tutorial– to represent which row should be selected in the list. I suppose in this way, unlimited loops can be established as the following table shows. 


 

However, I found it seems would only succeed when removing the “#” from equation: [eqGroupsFinal]. That is to say,
if [eqGroupsFinal] = {"#",join(eqWGN…)}, the string will not be in the right order. The 1st picture below represents an example of the disorder.
If [eqGroupsFinal] = {join(eqWGN…)}, the string is in the right order surprisingly (the 2nd picture below). But the consequence of removing “#” I found is the whole question group ‘1.1W’ with the condition “strpos(eqGroupsFinal, "W") > 0” will no longer show.

I’m so confused about it, as there seems no direct relationship between [eqGroupsFinal] and [string]. Wondering what seems to be the problem?


Many thanks,
Xueting
Last edit: 3 years 3 months ago by xueting.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #225512 by Joffm
Which confusion?
This is what I wrote in that German thread
Diese kann man mittels dieser Formel benutzen
{SAVEDID-x*floor(SAVEDID/x)}  wobei x die Zahl der gewünschten Gruppen ist.


So it is like a clock group (1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,...)
If you only use the SAVEDID you get an unlimited sequence.
What is really stupid as all possible variations of your 8-character-string  are limited (576).

Joffm


But I already showed you a better way:

2. Use a javascript snippet to create a random string.
a. Create two random strings of all 6 characters and join them. (javascript snippet)
b. According to the answers of the participant remove the not mentioned of WGN and the not selected from LST.
Example:
The random string is "GSNLWTSWLGNT"
eqGroupsFinal is "WGNS"
Now remove all characters from the random string that are not in eqGroupsFinal. functions "strpos" and "str_replace".
You get: "GSNWSWGN".


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

Please Log in to join the conversation.

  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 months ago #225515 by xueting
Thank you for taking the time to help me, my confusion has been cleared up.
Have a nice weekend!
Xueting

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose