Generate a random number code on survey end page

More
8 months 3 weeks ago #220447 by GBMIMM
Hi all, I'd like to end my survey by giving participants a unique survey completion code (a non-repeating 5 digit number) that appears on the final page of the survey.

Ideally, I'd like to be able to save these codes myself as participants would need it in order to withdraw from the study.

Can someone advise me how to implement this?

Best,
GM

Please Log in to join the conversation.

More
8 months 3 weeks ago #220456 by tpartner
Why not use the response ID?
{SAVEDID}

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: DenisChenu, holch

Please Log in to join the conversation.

More
8 months 2 weeks ago #220512 by GBMIMM
Hi Tony, thanks for the response and suggestion. Is there a tutorial available to implement this?

Please Log in to join the conversation.

More
8 months 2 weeks ago #220513 by Joffm
Hi,
there is nothing to implement.
This {SAVEDID} gives you the ID of the response in the answer table.
It is an autoincrement number - starting with 1.

Try it yourself.
Create a small survey, activate it, enter some responses and have a look at the answer table.
To see this ID, just enter the placeholder {SAVEDID} in the question text of one of your questions.

Probably you do not want to display a "00001" to the first respondent, you may "hide" it.
Maybe by adding a constant number like {sum(18300,SAVEDID)} or other mathematical transformations.

And you may read the manual here
manual.limesurvey.org/ExpressionScript_-_Presentation

 


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
8 months 2 weeks ago #220550 by holch
As the SAVEID is autoincremental, it might actually be a good idea to add a random part to it, like 3 random digits at the beginning, just to make it look like it is random. You can then ignore those 3 digits to identify the respondent and just use the numbers provided by the SAVEDID, which is always saved in your results table.

Might not be necessary in this specific case, but whenever you can easily "guess" codes, there are people how might use it to their advantage.

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.

More
8 months 2 weeks ago - 8 months 2 weeks ago #220569 by DenisChenu
Really unique ?
To be used as validation ?
gitlab.com/SondagesPro/QuestionSettingsType/generateUniqId

Because a 5 digit code is really bad for validation.

Else with Expression manager : in a equation question{if(is_empty(self.NAOK),rand(10000,99999),self.NAOK)}

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.
Last edit: 8 months 2 weeks ago by DenisChenu. Reason: Em solution

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now