Welcome to the LimeSurvey Community Forum

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

Text matching from Tokens

  • Matadeleo
  • Matadeleo's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 10 months ago #218743 by Matadeleo
Text matching from Tokens was created by Matadeleo
Hi,
I'm using tokens to fill answer options in a survey.



I'm getting the following results
Code:
{Q1.shown} // Returns VCU when ATTRIBUTE_8 selected
{is_string(Q1.shown)} // Returns 1
{if(Q1.shown == "VCU", 1, 0)} // Returns 0 should return 1
{if(join(Q1.shown, "") == "VCU", 1, 0)} // Returns 0 should return 1

This only seems to be an issue when using the value from the token field. If I replace the attributes in Q1 with hardcoded values, then there are no issues.

Anyone have any ideas how to get around this?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #218750 by tpartner
Replied by tpartner on topic Text matching from Tokens
Did you try removing whitespaces?

Code:
{if(trim(Q1.shown) == "VCU", 1, 0)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Matadeleo
  • Matadeleo's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 10 months ago - 3 years 10 months ago #218752 by Matadeleo
Replied by Matadeleo on topic Text matching from Tokens
Hi tpartner, I hadn't tried that option but it also doesn't seem to work/resolve the issue


There doesn't appear to be any whitespace or something odd going on with the attribute field for the test respondent



I could create a quick test survey if you wish to reproduce this
Last edit: 3 years 10 months ago by Matadeleo.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #218766 by tpartner
Replied by tpartner on topic Text matching from Tokens
Sure, but I won't be able to look until next week.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose