Insert a token (created automatically) in each new answer of a survey?

More
3 years 2 months ago - 3 years 2 months ago #112573 by mascarpone
mascarpone created the topic: Insert a token (created automatically) in each new answer of a survey?
Here it is:

I would like that for every new answer to a survey, a token be automatically generated an inserted (in the results table). I want to use that to allow tracking "versions" of that one answer (monitoring system).

Can that be done with the autocomplete function? or the equation type question? I am not familiar with these...

Thanks!
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112574 by mascarpone
mascarpone replied the topic: Insert a token (created automatically) in each new answer of a survey?
Hmmm, guess this is indeed manageable through the Expression Manager - as described here:

www.limesurvey.org/en/forum/can-i-do-thi...nd-store-in-question

My only problem now, is that this updates everytime I connect - and I would like it to work ONLY IF IT WAS PREVIOUSLY EMPTY - hence, once the code has been generated - it stays as such.

Is that feasible at all or do I need some surrounding code?
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112576 by mascarpone
mascarpone replied the topic: Insert a token (created automatically) in each new answer of a survey?
I guess that verifying whether my question answer is empty before running its equation won't work - sounds a bit like the "circular references" under excel...

Any idea?
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

More
3 years 2 months ago #112577 by tpartner
tpartner replied the topic: Insert a token (created automatically) in each new answer of a survey?
You can wrap it in an IF() statement to only load the question if empty. See this post - www.limesurvey.org/de/community/hilfe-fo...e-pin-for-user#81536

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: mascarpone

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112580 by mascarpone
mascarpone replied the topic: Insert a token (created automatically) in each new answer of a survey?
Thanks a lot tpartner, works perfectly!

A further question this: is there any simple way to complexify the token that is generated? could we insert here for example the code that used for LimeSurvey's regular tokens? I may in the long run generate quite a lot of these...
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112605 by mascarpone
mascarpone replied the topic: Insert a token (created automatically) in each new answer of a survey?
So, searching for other options of "token generator" in PHP (of which I understand little if any) I came across this:

md5(uniqid(rand(),true))

and I tried to implement it in EM like this:

{if(!is_empty(Rand),Rand,md5(uniqid(rand(),true))}


But it doesn't work: "md5", "uniqid" and "true"are highlighted... any idea why?
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

More
3 years 2 months ago #112607 by DenisChenu
DenisChenu replied the topic: Insert a token (created automatically) in each new answer of a survey?
Hi,

Because EM is not PHP. Not all available function from PHP are in EM : this need devlopement.

Speed reading the topic : i think i start for an 'automatic' register system.
When user start the survey : asking for token or propose to generate a new one.
After generation : show the token and a link to enter to the survey.

Denis
Dev base : gitorious.org/ls-extendregister doing a litlle, but give idea.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: mascarpone

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112609 by mascarpone
mascarpone replied the topic: Insert a token (created automatically) in each new answer of a survey?
Ok got it, thanks!

I'll go and look into your work as well! The possibility for user genearted token at the start sounds very interesting!

And in the meantime I'll move ahead with the great work provided by dweisser,

Thanks all! ;)
Last Edit: 3 years 2 months ago by mascarpone.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!