- Posts: 133
- Thank you received: 6
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
- Topic Author
- Offline
- Premium Member
Less
More
9 years 6 months ago - 9 years 6 months ago #112573
by mascarpone
Insert a token (created automatically) in each new answer of a survey? was created 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!
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 133
- Thank you received: 6
9 years 6 months ago - 9 years 6 months ago #112574
by mascarpone
Replied by mascarpone on 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?
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 133
- Thank you received: 6
9 years 6 months ago - 9 years 6 months ago #112576
by mascarpone
Replied by mascarpone on 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?
Any idea?
Last edit: 9 years 6 months ago by mascarpone.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
9 years 6 months ago #112577
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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
The topic has been locked.
- mascarpone
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 133
- Thank you received: 6
9 years 6 months ago - 9 years 6 months ago #112580
by mascarpone
Replied by mascarpone on 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...
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 133
- Thank you received: 6
9 years 6 months ago - 9 years 6 months ago #112605
by mascarpone
Replied by mascarpone on 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?
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
9 years 6 months ago #112607
by DenisChenu
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.
Replied by DenisChenu on 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.
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 133
- Thank you received: 6
9 years 6 months ago - 9 years 6 months ago #112609
by mascarpone
Replied by mascarpone on 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!
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.