Welcome to the LimeSurvey Community Forum

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

show question - not a condition

  • sjsls2016
  • sjsls2016's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #157758 by sjsls2016
show question - not a condition was created by sjsls2016
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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #157763 by tpartner
Replied by tpartner on topic show question - not a condition
The relevance equation for Q2 should simply be:

Code:
Q1_SQ001 == "A1"

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • sjsls2016
  • sjsls2016's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #157774 by sjsls2016
Replied by sjsls2016 on 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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #157802 by tpartner
Replied by tpartner on topic show question - not a condition
The syntax for conditionally piped text is:

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

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

Code:
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.
The topic has been locked.
  • sjsls2016
  • sjsls2016's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #157806 by sjsls2016
Replied by sjsls2016 on topic show question - not a condition
Thank you so much. You are always a savior. Keep it up.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose