Enabling conditions from answers in single select roster question

Hi all,

I have a problem in writing an enabling condition. The situation is follows.

I have a household roster section (member_roster). In this roster I ask information on the mother identity with the question “Who is the mother of %member_roster%?”(q1) enabled only if age<=2 years old. The possible options of this single select question are all the women older than 15 years in the listed in the household.

In another section of the survey I need to create another member roster on children nutrition (mother_roster) which is enabled only for female members aged older than 15 and that have been selected at least once as answer in q1. I need to ask to each of the female members selected in q1, the question “What are the benefits for a baby if he/she receives only breastmilk during the first six months of life?” (q2). In other words, I get a list of mothers from all the answers given in q1. I then need to ask only to these mothers a question, and if one mother has two children, i just need to ask once.

I don’t know how to enable the mother_roster only for all the mothers selected in q1.

I tried to impose the enabling condition on the mother_roster as

member_roster[q1[0]].@rowcode==@rowcode

and something similar, but it doesn’t work.

Hope somebody can help!

Thanks all

Hello Davide,

The “PUBLIC EXAMPLE CHILDREN OF EACH MOTHER” should have all the bits and pieces for this project:

It does ask questions for all eligible women (15+) and their children, but I’ve added a placeholder for questions to mothers of children present in the household. You can adapt the condition from there to your situation. (your q2 should go to subsection “Questions to mothers only”).

Hope this helps, if not, please elaborate.

Best, Sergiy Radyakin

Dear @sergiy,

Many thanks for your answer. I was actually following the example you provided, and with the addition you suggested it works perfectly.

If not too expensive, could you please instruct shortly me on how I should read the expression:

r_hh.Count(x=>IsAnswered(x.mother)?x.mother[0] == mother_code : false)

Perhaps, the next time I can try to figure it out myself.

Many thanks,
Best,
Davide

Basically the expression we want is this:

r_hh.Count(x=>x.mother[0] == mother_code)

which you can read as “Within the roster of household members, count those people who’s mother code (x.mother[0]) corresponds to the current woman’s code (mother_code).

Unfortunately, some of the mother’s codes (x.mother) may not be answered (yet or in principle). In that case addressing x.mother[0] will cause an exception and abort the calculation, resulting in the NULL value. We don’t want that to happen, so we precondition that with the IsAnswered().

r_hh.Count(

Within the roster of household members, count those people such that:

x=>IsAnswered(x.mother)
that the question on the ID of the mother is answered

? x.mother[0] == mother_code
and the code of the mother for that person is same as the current woman’s code (mother_code)

: false)
otherwise don’t count that person / disregard

1 Like