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?

More
3 years 6 months ago #225376 by Joffm
Addition to 2.
Without javascript you may create the string as you proposed in your table.
Create a random number (1-24) and with the "usual" nested IF create the string, like
{if(randnum==1,"WGNLSTTSLNGW",if(randnum==2,"GNWSTLLTSWNG",if...

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

Please Log in to join the conversation.

More
3 years 6 months ago #225385 by Joffm
Another addition:
Solution 2 works fine.

Two more hints:
In my opinion you should consider to exchange the letters "A", "B", "C",... to "W", "G", "N",... that it is better memorizable and you avoid this
{if(substr(string,0,1)=="A","W",if(substr(string,0,1)=="B","G",if(substr(string,0,1)=="C","N",if(substr(string,0,1)=="D","L",if(substr(string,0,1)=="E","S","T")))))}
Only {substr(string,0,1)}

your long IF orgia in "string" would have been shorter by joining 8 times.
You use the function "substr" and take the first 8 characters; so no matter how long the string is.
Of course you may use "substr" to shorten it ("{substr(join(x,x,x,x,...),0,8)}")

Joffm

By the way:
Do you have a LimeSurvey user group at TUE?
Shouldn't it be advisable?
Many of your fellow students appeared here, asked questions, got answers.
So there is a pool of knowledge in Eindhoven that should be worth to be shared.

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

Please Log in to join the conversation.

More
3 years 6 months ago #225428 by xueting
Thank you Joffm for taking your evening time to help me. I appreciate the hard work and effort that you put into my issue.

I assumed that maybe adding one more equation and the random would be realized. But after seeing your step-by-step instruction I realized it's not as simple as that. I apologize for taking it for granted.

As you see, I have been working on my survey for a very long time, revising it over and over again with growing anxiety, which sometimes makes me rush the process, while I shouldn’t. No background in programing also makes it difficult for me to master the approaches quickly. I would appreciate your understanding regarding this matter.

I’m really impressed by your multi-perspective thinking to solve a problem, which truly inspired me to think as scientific as possible, and from that I saw learning can actually be interesting, thank you for all the wisdom and passion you shared.

RE: Do you have a LimeSurvey user group at TUE?
There seems not, while there should be I think. I was suggested by fellow students to search answers or ask questions in the forum. I just wanted to let you know how special and appreciated you volunteers are by many of us.

Thanks again for your patience.

Regards,
Xueting

Please Log in to join the conversation.

More
3 years 6 months ago #225430 by xueting
Hi Joffm,

May I make sure an issue regarding the 1st method of the German post please? Thanks.
forums.limesurvey.org/forum/german-forum...ragen-gruppen#211405

I was wondering in which following way the sequential number SAVEDID is generated?

1) Once a person open the link the sequential number would be genetated;
2) Once a person finish the survey the sequential number would be genetated.

I suppose if the 1st way, then seems the method is plausible; while if it’s the 2nd way, the pitfall exists -‘as long as the first participant has not completed their survey, all the following participants will also end up in group 1’.

Regards,
Xueting

Please Log in to join the conversation.

More
3 years 6 months ago #225433 by tpartner
The response ID is generated when the row is added to the data table - after the first survey page is submitted.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: xueting

Please Log in to join the conversation.

More
3 years 6 months ago #225442 by xueting
Thank you tpartner for your prompt reply.

If I understand correctly, it's the 2nd way: once a person submits the survey the sequential number would be generated.

Regards,
Xueting

Please Log in to join the conversation.

More
3 years 6 months ago #225444 by DenisChenu
No,
SAVEDID generated just after the welcome page (the 1st next button action).
And sometimes can be generated at the welcome page (LimeSurvey version issue).

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.
The following user(s) said Thank You: xueting

Please Log in to join the conversation.

More
3 years 6 months ago #225446 by Joffm
Hi,
because you addressed me and mentioned this small "tutorial" in the German part:
All others wrote already, it is generated at the start.
Otherwise there wouldn't be a key to save the data.
And, of course, try it.
Activate a small survey, start it and close the browser tab.
In the answer table you will find this record (with the "id")

Joffm

 

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

Please Log in to join the conversation.

More
3 years 6 months ago #225447 by xueting
Understand. Thank you Joffm!

Regards,
Xueting

Please Log in to join the conversation.

More
3 years 6 months ago - 3 years 6 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 6 months ago by xueting.

Please Log in to join the conversation.

More
3 years 6 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.

More
3 years 6 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