Welcome, Guest
Username: Password: Remember me

TOPIC: Can I populate token attributes with question answers?

Can I populate token attributes with question answers? 3 years 2 months ago #62052

  • MikeFloyd
  • MikeFloyd's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Can I populate token attributes with question answers? 3 years 2 months ago #62097

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4130
  • Thank you received: 763
  • Karma: 347
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Can I populate token attributes with question answers? 3 years 2 months ago #62124

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.110 seconds
Donation Image