Check out the LimeSurvey source code on GitHub!

Can I populate token attributes with question answers?

More
5 years 8 months ago #62052 by MikeFloyd
Can I populate token attributes with question answers?

I am thinking of populating the "Uses Left" attribute when the user specifies how many times they need to complete the survey.

I want to ask how many people are in household in one survey and use data to set attribute for the number of uses of the second survey.

Please Log in to join the conversation.

More
5 years 8 months ago #62097 by tpartner
The only way to do that would be fire a PHP script that would write to the database - tricky.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 8 months ago #62124 by TMSWhite
MikeFloyd-

We're working on a generic, non-JavaScript-dependent, solution to issues like the one you've described. Please comment on this thread if there is functionality we've missed.

Currently, our equation parser only provides read-only access to variables. If we let Tokens be "registered variables", and provide read-write access, then we could easily populate a token attribute with a question answer.

For safety, we could issue a Warning when saving such equations so that people don't accidentally confuse a==b with a=b; or we could use an alternate assignment syntax, like a:=b, or skip syntax altogether, and create a function assign(variable,value), and only allow assignment of values to registered variables.

/Tom

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form