- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Generate code at the end of survey - for mTurk
- EmE9
- Topic Author
- Offline
- New Member
Less
More
8 years 5 months ago #128638
by EmE9
Generate code at the end of survey - for mTurk was created by EmE9
Hello,
I would like to use LimeSurvey on mTurk and I need a way to generate a unique code (randomly) in the end message, that would be saved in the survey results preferably. In order to get paid, participants can then type in the code in mTurk and I would know that they have actually finished the survey.
Any help would be appreciated as I have not found good info on this problem
Best,
I would like to use LimeSurvey on mTurk and I need a way to generate a unique code (randomly) in the end message, that would be saved in the survey results preferably. In order to get paid, participants can then type in the code in mTurk and I would know that they have actually finished the survey.
Any help would be appreciated as I have not found good info on this problem
Best,
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 5 months ago #128639
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Generate code at the end of survey - for mTurk
Hi ,
there are 2 old great posts about this topic (using differents ways)... here (using Expression Manager) and there (using chance.js)
there are 2 old great posts about this topic (using differents ways)... here (using Expression Manager) and there (using chance.js)
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- EmE9
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
8 years 5 months ago #128644
by EmE9
Replied by EmE9 on topic Generate code at the end of survey - for mTurk
Hi,
thanks a lot. If I could have just a bit of your time since I am a total beginner. I have seen this SAVEDID option but I am not sure to what it relates to. Is this an option that is choosable or is it something that I need to have coded for. Plus, how would this ID be shown to the participants at the end?
All the best,
thanks a lot. If I could have just a bit of your time since I am a total beginner. I have seen this SAVEDID option but I am not sure to what it relates to. Is this an option that is choosable or is it something that I need to have coded for. Plus, how would this ID be shown to the participants at the end?
All the best,
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 5 months ago #128646
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Generate code at the end of survey - for mTurk
"SAVEDID" is the respondant ID. It's a unique number (incremental, start is #1) for a survey but if you have several survey it's not so unique. You can print it at the end using the placeholder {SAVEDID}
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
8 years 5 months ago - 8 years 5 months ago #128654
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Generate code at the end of survey - for mTurk
You can combine it with the survey ID....but if you have several survey it's not so unique.
Code:
{SID}{SAVEDID}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 5 months ago by tpartner.
The topic has been locked.
- EmE9
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
8 years 5 months ago #128658
by EmE9
Replied by EmE9 on topic Generate code at the end of survey - for mTurk
Thanks to all.
If anybody else stumbles on this, I've managed to produce a random string of digits using the code already mentioned in one of the linked pages above.
{if(!is_empty(PIN),PIN,1*rand(357382, 908173))}
"PIN" is the name of your question group or just the questions (this can obviously be anything you want to name it). For me, as is per usual in mTurk, it was important to have a six digit number so I just basically said the rand() function to randomise between two six digit numbers (they can also be anything really). Not the most elegant solution but it works.
Hope it helps.
If anybody else stumbles on this, I've managed to produce a random string of digits using the code already mentioned in one of the linked pages above.
{if(!is_empty(PIN),PIN,1*rand(357382, 908173))}
"PIN" is the name of your question group or just the questions (this can obviously be anything you want to name it). For me, as is per usual in mTurk, it was important to have a six digit number so I just basically said the rand() function to randomise between two six digit numbers (they can also be anything really). Not the most elegant solution but it works.
Hope it helps.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11661
- Thank you received: 2742
8 years 5 months ago #128659
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Generate code at the end of survey - for mTurk
You are aware that the same code could appear more than once, right? Ok, the chance is low, but it is there...
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- EmE9
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
8 years 5 months ago #128663
by EmE9
Replied by EmE9 on topic Generate code at the end of survey - for mTurk
Yes, absolutely, but I'm starting the study in one day, so I'm willing to accept the risk. Plus, the, admittedly low chance of reoccurrence is worth it as I plan on some 100 - 200 participants.
Do you have a way of ensuring that it never repeats?
Best,
Do you have a way of ensuring that it never repeats?
Best,
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
8 years 5 months ago #128665
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Generate code at the end of survey - for mTurk
Incorporate the SAVEDID as Ben suggests.Do you have a way of ensuring that it never repeats?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 5 months ago #128666
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Generate code at the end of survey - for mTurk
The problem with the SAVEDID is it can be 1, 2, 3 (even more) digits, so an advanced equation is required to match the required length...
Using time() & rand () with 6 digits, an option is: (IMHO, with 200 participants, the probability of duplicate PIN outputs, may be the same than for of a sudden meteor shower on the server)
Using time() & rand () with 6 digits, an option is: (IMHO, with 200 participants, the probability of duplicate PIN outputs, may be the same than for of a sudden meteor shower on the server)
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
8 years 5 months ago - 8 years 5 months ago #128667
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Generate code at the end of survey - for mTurk
You can pad it with zeros depending on the length.The problem with the SAVEDID is it can be 1, 2, 3 (even more) digits
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 5 months ago by tpartner.
The following user(s) said Thank You: schmittg91
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11661
- Thank you received: 2742
8 years 5 months ago - 8 years 5 months ago #128669
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Generate code at the end of survey - for mTurk
But if you have a fixed length code randomly generated number and then join the saved id at the end it should be fine. At least if you don't care that the final code could be anything from 7 to 9 digits long. But you will know that everything after the sixth digit is the savedid.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 8 years 5 months ago by holch.
The topic has been locked.