Constraints help

I'm trying and struggling to structure some constraints around select_one
or select_multiple questions. Hoping there is a brainy someone out there
who can help!

Q1: select_one interventions
choices:

  • creche
  • toy library
  • reading room
  • home based care
  • health campaign
  • awareness campaign

Q2: select_multiple agegroups
choices:

  • 0-12 months
  • 12-24 months
  • 24-36 months
  • 36 - 48 months

So, what I want to do is this:

  • if in Q1 you select either creche, toy library or reading room, in q2 you
    can only select 24-36 months and 36-48 months.
  • if in Q1 you select home based care, in Q2 you can only select 0-12
    months or 12-24 months
  • if in Q1 you select health or awareness campaign, in Q2 you can choose
    any age group.

I guess that I could do this through using separate questions and
relevancies, but I am wondering if it is possible do do this by writing a
constraint? Any ideas?

Emma,

You'll have to setup your questions with following codes:

q1

  • creche = 1
  • toy library = 2
  • reading room = 3
  • home based care = 4
  • health campaign = 5
  • awareness campaign = 6

q2

  • 0-12 months = 1
  • 12-24 months = 2
  • 24-36 months = 3
  • 36 - 48 months = 4

In the constraint part of the q2, you should write:

((/data/q1>=1) and (/data/q1<=3) and (selected(. , '1') or (selected(. ,
'2'))) or ((/data/q1=4) and (selected(. , '3') or (selected(. , '4')))

Furthermore, put both questions on separate screens.

Ayub