Welcome to the LimeSurvey Community Forum

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

Generate Random 4-digit Participant ID

  • SochillScienz
  • SochillScienz's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 months 3 days ago #243738 by SochillScienz
Generate Random 4-digit Participant ID was created 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.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 months 2 days ago #243766 by holch
Replied by holch on topic Generate Random 4-digit Participant ID
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:
{rand(1000,9999)}.

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.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 months 2 days ago #243770 by DenisChenu
Replied by DenisChenu on topic Generate Random 4-digit Participant ID
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