- Posts: 74
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
If condition from token field not working
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
7 years 10 months ago #137725
by Winocll_48635
If condition from token field not working was created by Winocll_48635
I'm testing limesurvey if conditions coming from token fields and am unable to get it to work.
I've set up additional attribute fields where 'ATTRIBUTE_4' has the field description of 'state'. In this field, as you can imagine, the state of the individual record exists (e.g. TX, OH, NY, etc.)
When i display the tokens the 'state' field is there, and it is populated with the correct state data.
In my survey i put a simple test question of "How do you like Texas?" and an if condition that looks like this in the 'relevance equation'...
((TOKEN:ATTRIBUTE_4 == "TX"))
When i test the survey those with TX in the field do not get the question.
What am i doing wrong?
I've set up additional attribute fields where 'ATTRIBUTE_4' has the field description of 'state'. In this field, as you can imagine, the state of the individual record exists (e.g. TX, OH, NY, etc.)
When i display the tokens the 'state' field is there, and it is populated with the correct state data.
In my survey i put a simple test question of "How do you like Texas?" and an if condition that looks like this in the 'relevance equation'...
((TOKEN:ATTRIBUTE_4 == "TX"))
When i test the survey those with TX in the field do not get the question.
What am i doing wrong?
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
7 years 10 months ago #137728
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic If condition from token field not working
How do you put this? As a relevance equation or do you go through the token system? I could write it without "((" and "))", but I don't know if this is the problem.
Now how do you test this? With the survey activated? Not activated?
And most importantly: What version of Limesurvey are you using?
Now how do you test this? With the survey activated? Not activated?
And most importantly: What version of Limesurvey are you using?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- fvanderstarre
- Offline
- Elite Member
Less
More
- Posts: 176
- Thank you received: 36
7 years 10 months ago #137738
by fvanderstarre
Replied by fvanderstarre on topic If condition from token field not working
Also, make sure your survey is NON-anonymous (I have been there....)!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
7 years 10 months ago #137742
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 If condition from token field not working
And myabe try to fix the attribute before testing, i always add trim function when using token : a hidden space in excel is quick....
trim(TOKEN:ATTRIBUTE_4) == "TX"
trim(TOKEN:ATTRIBUTE_4) == "TX"
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 topic has been locked.
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
- Posts: 74
- Thank you received: 1
7 years 10 months ago #137773
by Winocll_48635
Replied by Winocll_48635 on topic If condition from token field not working
All of the advice has been tried and it's still not working.
My version of LimeSurvey is: Version 2.06+ Build 151016
I originally put the if condition in by using the 'set conditions for this question' icon. When trying the advice in this thread i used the relevance equation (which is where the 'set conditions...' icon put the condition in the first place.
I'm testing it after the survey is activated.
My version of LimeSurvey is: Version 2.06+ Build 151016
I originally put the if condition in by using the 'set conditions for this question' icon. When trying the advice in this thread i used the relevance equation (which is where the 'set conditions...' icon put the condition in the first place.
I'm testing it after the survey is activated.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago #137782
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 If condition from token field not working
Try putting this in the text of a question somewhere to see exactly what is being returned.
Code:
{TOKEN:ATTRIBUTE_4}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
- Posts: 74
- Thank you received: 1
7 years 10 months ago #137785
by Winocll_48635
Replied by Winocll_48635 on topic If condition from token field not working
Great idea.
When i put that into the question source and then test the survey nothing comes up from the attribute_4 field.
So something's happening where i am not actually accessing the token data.
When i put that into the question source and then test the survey nothing comes up from the attribute_4 field.
So something's happening where i am not actually accessing the token data.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago #137786
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 If condition from token field not working
Hmm...that should work (and does in my 2.06) whether the survey is activated or not. I assume you are using all upper-case for "TOKEN:ATTRIBUTE_4" (your last post has it in lower-case).
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
7 years 10 months ago #137787
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic If condition from token field not working
Any chance you can export a sample of your tokens? Obviously without private data of your respondents, but dummy data? A screenshot might do, just to make sure that the token table is allright.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
- Posts: 74
- Thank you received: 1
7 years 10 months ago #137843
by Winocll_48635
Replied by Winocll_48635 on topic If condition from token field not working
Yes, it is all caps in the limesurvey.
The topic has been locked.
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
- Posts: 74
- Thank you received: 1
7 years 10 months ago #137847
by Winocll_48635
Replied by Winocll_48635 on topic If condition from token field not working
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago #137849
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 If condition from token field not working
That looks okay, but have you created a token where attribute_4 is set to "TX"? Can we see a screenshot of that row in the token list?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.