Welcome to the LimeSurvey Community Forum

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

Generate Unique PIN for user

More
11 years 10 months ago #80502 by mkb
Generate Unique PIN for user was created by mkb
Hi,
Trying to find the best way to do this:

I have a survey where the people taking it need to be anonymous (for their company info). It is possible that the person would like to get more information on their own after the survey. I thought that I could generate a unique PIN number that would show at the beginning of the survey with text telling them to remember this number for future use..yadda yadda. That way if they do want more info, they can tell us the number and we can just pull out their answers. The way this survey works..they cannot do it twice.

I cannot use token/emails..because the user would think their answers could be tracked back to them...also multiple users could be taking the survey on one computer at work..so IP wont give them away.

I read about insertrans, savedid, etc...not sure if what I want to do would apply.

Any help will be greatly appreciated,
Marilyn
The topic has been locked.
More
11 years 9 months ago #81454 by ricopoco
Replied by ricopoco on topic Generate Unique PIN for user
Ditto. I need this option as well. We are collecting anonymous research data in a university setting. Ethics requirements call for us to be able to remove a participant's at their request. We'd like to give each participant a unique PIN at the outset so that if they contact us, we can identify their data set.

So, if this is doable, I too would greatly appreciate the info. Thanks much.
The topic has been locked.
More
11 years 9 months ago #81457 by mkb
Replied by mkb on topic Generate Unique PIN for user
Hi, Sorry I have been so busy lately I should have came back here and explained how I got this to work.

Just use: SAVEDID

It is my understanding that you have to have a question answered before it will show the number....so I just had a survey agreement where they click yes before they take the survey. I also placed it at the end of the survey as a reminder.

i.e. Please remember this number if you would like to discuss your individual results: SAVEDID (which will show the unique ID number).

I am not sure but I think I remember that the survey needs to be Active/Live before you will see the actual number.

My survey is now live and it is working just fine.

Hope this helps,
Marilyn
The following user(s) said Thank You: ricopoco
The topic has been locked.
More
11 years 9 months ago #81489 by ricopoco
Replied by ricopoco on topic Generate Unique PIN for user
Sounds like it will do exactly what I need it to do -- I'll play with that. Thank-you for sharing!
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
11 years 9 months ago #81528 by Mazi
Replied by Mazi on topic Generate Unique PIN for user

mkb wrote: Hi, Sorry I have been so busy lately I should have came back here and explained how I got this to work.

Just use: SAVEDID

It is my understanding that you have to have a question answered before it will show the number....so I just had a survey agreement where they click yes before they take the survey. I also placed it at the end of the survey as a reminder.

i.e. Please remember this number if you would like to discuss your individual results: SAVEDID (which will show the unique ID number).

I am not sure but I think I remember that the survey needs to be Active/Live before you will see the actual number.

My survey is now live and it is working just fine.

Hope this helps,
Marilyn

Marilyn,
you are right at each point. The SAVEDID is the unique ID for each data set at the lime_survey_12345 table and it is only available for activated surveys AND you need to have clicked "next" at least once to store partial survey data and get such an ID assigned.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
11 years 9 months ago #81530 by floccs
Replied by floccs on topic Generate Unique PIN for user
You can also use a workaround I've created.
Anonymously track respondents answers across multiple surveys
This allow to track participants without the need to remember any ID.
The topic has been locked.
More
11 years 9 months ago #81534 by ricopoco
Replied by ricopoco on topic Generate Unique PIN for user
Snooping around, it looks like SAVEDID is simply seqentiall numbers. I need something that would provicde IDs that are not easily be guessed. I'm going to try using a hidden question with the label "PIN" and the default answer to something like {time()*rand()}. Then I'll use INSERTANS to provide the PIN to the respondent. I'll post the details when I've worked them out and run some tests.
The topic has been locked.
  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 9 months ago #81536 by TMSWhite
Replied by TMSWhite on topic Generate Unique PIN for user

ricopoco wrote: Snooping around, it looks like SAVEDID is simply seqentiall numbers. I need something that would provicde IDs that are not easily be guessed. I'm going to try using a hidden question with the label "PIN" and the default answer to something like {time()*rand()}. Then I'll use INSERTANS to provide the PIN to the respondent. I'll post the details when I've worked them out and run some tests.


There is an example like that here . Create an Equation-type question, named PIN, and put this code in it:
Code:
{if(!is_empty(PIN),PIN,time()*rand())}

That will ensure that PIN only gets generated once (instead of once per page visit and validation).
The following user(s) said Thank You: Qsgt
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago #114190 by holch
Replied by holch on topic Generate Unique PIN for user
Sounds good, but isn't there a slight chance that there could be duplicates like this?

I know that the chances is relatively small considering that you use the time stamp multiplied by a random number. But still there is a chance, right?

Rand would create a number from 0-9, right?

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.
More
9 years 4 months ago #114191 by Ben_V
Replied by Ben_V on topic Generate Unique PIN for user

holch wrote: Rand would create a number from 0-9, right?


Using {rand()} expression, I've always seen a quiet big 8, 9 or 10 digits number.
You can set some range precision with the following format :
{rand(99, 499)}

Related: Chance.js : Utility library to generate anything random for JavaScript

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.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 4 months ago #114196 by Mazi
Replied by Mazi on topic Generate Unique PIN for user

holch wrote: Sounds good, but isn't there a slight chance that there could be duplicates like this?

Theoretically yes, but the chance is really, really low.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
8 years 3 months ago #128686 by Ben_V
Replied by Ben_V on topic Generate Unique PIN for user

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.

Lime-years ahead

Online-surveys for every purse and purpose