Conditionals: change and to or

More
5 years 4 months ago #91193 by sD960
sD960 created the topic: Conditionals: change and to or
Hello, my name is Fee. I'm quite new to LimeSurvey, and not very sophisticated programming-wise. I am using responses to an Array to determine whether the next question will be visible. A fake example: The Array question is "What do you think of your neighbors", and the array has 2 items on the Y-axis (him, her) and 4 on the X-axis (nice, smart, mean, stupid). I want the next question ("Will you invite them for dinner") to show up only if the survey-taker clicks on him-nice, OR him-smart, OR her-nice, Or her-smart. However, in setting the conditions, LimeSurvey seems to only allow me to set him-nice OR him-smart, AND her-nice OR her-smart. That is, there has to be both a him- AND a her-response (to either nice or smart), instead of what I want, which is any ONE of the 4 him-her-nice-smart responses. I guess I could work around this by having two separate but identical "Will you invite them for dinner" questions--that is, one conditional on the him-responses and one on the her-responses, but that seems really inelegant. Help?!

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #91211 by tpartner
tpartner replied the topic: Conditionals: change and to or
If using the conditions designer, you can use scenarios - docs.limesurvey.org/Setting+conditions&s..._the_use_of_scenario

If using Expression Manager and relevance, you can use the OR operator - docs.limesurvey.org/Expression+Manager&s...or+LimeSurvey#Syntax

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #91235 by sD960
sD960 replied the topic: Conditionals: change and to or
Thanks, using scenario did the trick. This is great, especially as my inelegant fix wouldn't have worked anyway, as it would have made the follow-up question "Will you invite them for dinner" appear twice if the survey-taker had selected either him-nice or him-smart AND either her-nice and her-smart.

For the benefit of other users at or below my advanced-beginner level with an analogous OR-vs-AND issue, and since it can be daunting wading through all the information to learn how to solve one's particular problem, I'll explain what I did:

When setting the conditions, I clicked on the Scenario button which showed a default label of 1, and chose him-nice and him-smart, which set up the conditions him-nice OR him-smart, and added those conditions. I then clicked on the Scenario button again which automatically showed a label of 2, chose her-nice and her-smart, which set up the conditions her-nice OR her-smart, and added those conditions. LimeSurvey automatically sets an OR between scenarios 1 and 2, so I end up with ([him-nice OR him-smart] OR [her-nice OR her-smart]). This may seem like a complicated way to get to (him-nice OR him-smart OR her-nice OR her-smart)--logically I don't need the sub-parentheses--but it works!

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!