Welcome to the LimeSurvey Community Forum

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

Generate Random 4-digit Participant ID

1 week 6 days ago #243738 by SochillScienz
Please help us help you and fill where relevant:
Your LimeSurvey version: 3.28.57
Own server or LimeSurvey hosting:
Survey theme/template:
Hi Everyone!

I am designing a pre- and post- LimeSurvey and want to design the pre-survey so that it automatically generates a unique, randomly generated 4-digit Participant ID. I then want this Participant ID to be emailed to them when I sent out invitations to complete the post-survey. Then, for the post-survey I want them to use this same generated ID to be able to log in and complete the post- survey. 

However, I am quite new to LimeSurvey and am having difficulty trying to do this. Any advice or alternatives would be greatly appreciated! Also if this has already been asked if you could provide a link to the article that would also be great.
Thank you!

Please Log in to join the conversation.

1 week 5 days ago #243766 by holch
The problem with random 4 digit IDs is, that they are random, and not exclusive.

You could quite easily generate a 4 digit number like this:

However, there is a chance that this process might generate the same 4 digit number more than once and you can't control it.

So what I recommend is to generate a random number and join it with the SAVEDID, which for a survey is always unique.

For the follow up survey you can then use the generated code as the token in a closed survey.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

1 week 5 days ago #243770 by DenisChenu
What is your exact need ?

maybe something like that: gitlab.com/SondagesPro/SurveyAccess/surveyChaining

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose