Welcome to the LimeSurvey Community Forum

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

Display text based on variable content

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 months 3 weeks ago #250892 by baxterdmutt
Display text based on variable content was created by baxterdmutt
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.2.9
Own server :
Survey theme/template:fruity twenty three
==================
min having a user choose Metric or Imperial from a drop-down.Later in the same group I want to say Please enter you weight in (lbs or kgs). 
I’ve tried:
{if((G1Q00002==‘Metric’),’kgs’,’lbs’)}
but it always shows lbs
I just have it inline of the question like this:
Enter your weight in {if((G1Q00002==‘Metric’),’kgs’,’lbs’)}

What am I doing wrong, please. I’ve tried going through the manual and that’s where I got this from. I must be misunderstanding. 
 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago #250893 by tpartner
Replied by tpartner on topic Display text based on variable content
You need to use the answer code in the IF statement, not the answer text.

Code:
{if(G1Q00002==‘answerCode’, ’kgs’, ’lbs’)}

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.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 months 3 weeks ago #250894 by baxterdmutt
Replied by baxterdmutt on topic Display text based on variable content
Wow. I was so close. Thank you for your fast reply.

Please Log in to join the conversation.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 months 3 weeks ago - 6 months 3 weeks ago #250899 by baxterdmutt
Replied by baxterdmutt on topic Display text based on variable content
Ok, this is weird. Everything was fine and now I’m getting strange behaviour.
I have the Drop-down that asks for metric or imperial. Then I have a question that asks are you one of 2 types of people.
From that answer I set conditions to display one list of 10 question.
If you say you are Type A then you get questions 4 to 8.
If you say you are Tupe B then you get questions 9-13
Before I added the above code to question 8 and 13 that worked fine. Since adding the code, it won’t show the questions and even removing the coding doesn’t help. I checked the logic file and it says all is fine.
Anybody have any ideas.
Last edit: 6 months 3 weeks ago by baxterdmutt. Reason: Typo

Please Log in to join the conversation.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 months 3 weeks ago #250902 by baxterdmutt
Replied by baxterdmutt on topic Display text based on variable content
Ok this has nothing to do with this subject matter. Turns out the date won’t show the calendar for some strange reason and everything works fine if I change the format to drop-down dates. I remember now that I had upgraded from 6.2.6 to 6.2.9. I think I found a bug and will report it.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 3 weeks ago - 6 months 3 weeks ago #250906 by Joffm
Replied by Joffm on topic Display text based on variable content
Hi,
as you say, these are different topics.
Please, open a new thread for a new topic.

I am not surprised to read frequently "I searched the forum but didn't find" if a thread "Display text based on ..." contains an issue about the date picker.

Regarding your issue about the conditions, I have an idea but what to say without seeing what you really did.
You should send a lss export of these relevant questions.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 months 3 weeks ago #250926 by baxterdmutt
Replied by baxterdmutt on topic Display text based on variable content

Hi,
as you say, these are different topics.
Please, open a new thread for a new topic.

I am not surprised to read frequently "I searched the forum but didn't find" if a thread "Display text based on ..." contains an issue about the date picker.
When I left that message I honestly believed it had something to do with my original question and that the script somehow affected the date picker. Although I had no idea how. 
As far as a new post goes, I believe I said I’d post a bug report. 

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose