Enabling condition based on roster answers


I have a roster that lists the information for all household members (age, gender etc.). A subsequent section should only be available if the household has members ages 5-12 (these are household level questions not individual ones). Additionally, this section should reference the name of the eldest household member within this age group (5-12). I’ve managed to enable the subsection for this age group but cannot add the name of the eldest household member to the question text.

RosterNAME.Any(x=>x.AGE>=5 && x.AGE<=12)

any help would be greatly appreciated! thanks!

Would creating a variable for the eldest member of the household work? How would I create the variable if the information is in two questions within a roster? (Name of members and age)


Selecting the person’s name depends where the name of each member is obtained in the first place.

  1. If RosterNAME is sourced by a numeric question (e.g. “How many persons do live here?”) and within each row you ask the person’s name, the example here is exactly what you are looking for.

  2. If RosterNAME is sourced by a list question (e.g. hhname_list: “Please list all the names of the HH members”) and for each roster row you only obtain the age & gender you can try sth. of the following:
    Create a long integer variable to store the INDEX of the eldest household member in this age bracket named index_oldest with expression:


In addition, create a string variable, e.g. name_oldest_5_12 with expression:


As noted in the article I refer to above,

Note that if there are two or more children of the same age exist in the same household, then the one entered first will be selected.

also applies here. Consider adding more order variables such as gender or education.

You can use name_oldest_5_12 to display the name of the eldest household member in question texts within your section that you correctly enabled if there is any HH member aged 5-12.


works perfectly thank you!!!

Following up on my last post, I’ve managed to successfully create string variables with the names of household members given certain conditions as my roster was sourced by a numeric question.

I’d like to create an additional string variable that satisfies the following conditions to substitute as text in other questions:
-If the respondent is the household head, use “you”
-If the respondent is NOT the household head use the name identified in the roster.

I have a single-select question based on the roster names to select the respondent. Additionally, I’ve created a string variable with the household head name based on the roster and another string variable containing “you”. I’m trying to create the new “name” variable using the respondent answer and the two string variables mentioned. I’ve tried the following code but it doesn’t work…

&& IsAnswered(p.respondent)
).you ||

&& IsAnswered(p.respondent)

many thanks!

1 Like

Most people don’t bother and write you/%name% giving the choice to the enumerator.
What you want is, of course, possible but will create problems once you want to make it localized.

In order to check the syntax one needs to know the structure of your questionnaire (which question is asked at which level and is of which type).

A general advice is to try to avoid entering the same name twice and comparing the names “John”== " John" is bound to fail frequently.

Thank you Sergiy. The survey is at the household level but the questions I’m referring to are for individuals. I think the issues with entering the same name twice would be avoided in this case since the name is only entered once and referred to in another question by pulling the roster name list.

I’m trying to enter the you/%name% case based on the household roster question relationship to household head AND a question asking the interviewer who the respondent is based on the roster names. Is it possible?

Try something along the lines of


Datatypes are shown here.