Welcome to the LimeSurvey Community Forum

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

Display text based on variable content

More
1 year 10 months ago #250892 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.

More
1 year 10 months ago #250893 by tpartner
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.

More
1 year 10 months ago #250894 by baxterdmutt
Wow. I was so close. Thank you for your fast reply.

Please Log in to join the conversation.

More
1 year 10 months ago - 1 year 10 months ago #250899 by baxterdmutt
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: 1 year 10 months ago by baxterdmutt. Reason: Typo

Please Log in to join the conversation.

More
1 year 10 months ago #250902 by baxterdmutt
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.

More
1 year 10 months ago - 1 year 10 months ago #250906 by Joffm
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: 1 year 10 months ago by Joffm.

Please Log in to join the conversation.

More
1 year 10 months ago #250926 by baxterdmutt

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.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose