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?

More
10 years 3 weeks 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.
More
10 years 3 weeks 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.
More
10 years 2 weeks 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".
www.limesurvey.org/manual/Setting_condit...nition_of_a_scenario .
Or more general:
www.limesurvey.org/manual/Setting_condit...ndition_combinations

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
10 years 2 weeks ago - 10 years 2 weeks ago #139815 by tpartner
I think, because Q2 is conditional, the key (as Joffm points out) is to use ".NAOK" in the relevance statement - www.limesurvey.org/manual/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: 10 years 2 weeks ago by tpartner.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose