Welcome to the LimeSurvey Community Forum

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

How to make the relevance equation work when using two questions?

  • pieter1970
  • pieter1970's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #139805 by pieter1970
I know, this should be possible, but i do not know how. I have three questions, like the following

Q1: are you married?
1-Yes
2- No

Q2: do you live together? --> only asked when Q2=No(2)
1- Yes
2- No

Q3: What's the gender of your inmate? --> Only asked when Q1=Yes (1) or Q2=no (2)
1- Male
2-Female

I tried several equations in the relevance for Q3, but unfortunately did not succeed in getting this right.
For example: Q1==1 or Q2==2 was not succesful
Any help will highly be appreciated!
Pieter
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago #139807 by Joffm
Hi, Pieter,
(Q1.NAOK == "1") or (Q2.NAOK == "1")

Regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago #139811 by Joffm
Hi, Pieter,
of course it is (Q2.NAOK=='2').

Yesterday it was too late to write more.
Well, the default behaviour of LS is:
If there are two different questions involved the condition manager always is AND like (Q1=1) AND (Q2=1).
If there is only one question it' s OR like (Q1=1) OR (Q1=5).

In your case you have to use scenarios in "Set conditions".
manual.limesurvey.org/Setting_conditions...nition_of_a_scenario .
Or more general:
manual.limesurvey.org/Setting_conditions...ndition_combinations

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago - 7 years 7 months ago #139815 by tpartner
I think, because Q2 is conditional, the key (as Joffm points out) is to use ".NAOK" in the relevance statement - manual.limesurvey.org/Expression_Manager#Usage_of_NAOK

Code:
Q1.NAOK == 1 OR Q2.NAOK == 2

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 7 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose