show question - not a condition

More
2 months 2 days ago #157758 by sjsls2016
sjsls2016 created the topic: show question - not a condition
Hi there.
Just a quick question.


how do I show the question if the answer to a previous question is equal to "A1", not hidden question condition
Scenario is...

Q1 - Array
What animals do you like?
SQ001 - Dog A1 - Yes A2 - No
SQ002 - Cat A1 - Yes A2 - No


Q2 - Text display

You said you love {Q1_SQ001.question}
how do I show/display this question if the answer is "A1" for the Q1

{Q1_SQ001.question(if(Q1_SQ001 == "A1"))} ---- this did not work.

What would be the correct way of using it?
Thank you for the reply.

Please Log in to join the conversation.

More
2 months 2 days ago #157763 by tpartner
tpartner replied the topic: show question - not a condition
The relevance equation for Q2 should simply be:

Q1_SQ001 == "A1"

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
2 months 1 day ago #157774 by sjsls2016
sjsls2016 replied the topic: show question - not a condition
Thank you for taking interest in my post but I am sorry it's not what I mean. My Q2 is text display question and I want the "question" to be displayed or show up in the text display line only if the answer to Q1 sq001 is A1 or Q1 sq002 is A1.

I was able to show the question by using this code "{Q1_SQ001.question}" but I don't know how to insert the condition --- Type q1_sq001.question if q1_sq001 == A1... Please help me how to do that in limesurvey language. Thank you.

Please Log in to join the conversation.

More
2 months 1 day ago #157802 by tpartner
tpartner replied the topic: show question - not a condition
The syntax for conditionally piped text is:

{if(condition, 'Text if true', 'Text if false')}

So, your text for the question could be something like:

You said you love {if(Q1_SQ001 == 'A1', Q1_SQ001.question, '')}{if(Q1_SQ001 == 'A1' AND Q1_SQ002 == 'A1', ' and ', '')}{if(Q1_SQ002 == 'A1', Q1_SQ002.question, '')}.

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
2 months 1 day ago #157806 by sjsls2016
sjsls2016 replied the topic: show question - not a condition
Thank you so much. You are always a savior. Keep it up.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now