Welcome to the LimeSurvey Community Forum

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

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

  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112573 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.
  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112574 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.
  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112576 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #112577 by tpartner
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
The topic has been locked.
  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112580 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.
  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112605 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #112607 by DenisChenu
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 , plugin development .
I don't answer to private message.
The following user(s) said Thank You: mascarpone
The topic has been locked.
  • mascarpone
  • mascarpone's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago - 9 years 6 months ago #112609 by mascarpone
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: 9 years 6 months ago by mascarpone.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose