Validation Condition that Depends on Roster


I am trying to create a validation condition that calls upon an answer provided in a roster. I created a roster, called HHroster, for which respondents will provide a list of all household members 18 years or older. Included in the roster for each household member will be their name, gender, and age.

Later in the survey the interviewer will ask the selected respondent their age. I want to create a validation condition to display an error message if the age provided by the selected respondent is >10 years different from the age provided in the roster. However I’m unsure how to call the age variable from the roster so the program knows which respondent age to check against in the validation condition.

Q1.Roster: How old is %HHroster%?

Q1.Interview: Before we begin, how old are you?

I essentially want the validation to read: Math.Abs(Q1.Interview - Q1.Roster)<=10


1 . Why do you want to obtain the age of a person for a second time? This information is already available to you and you can save time in the interview process by not asking it again.

2 . If you want to get it validated / obtain for a 2nd time:

For clarity, I call your age question WITHIN HHroster: q1_age

The software needs to know which person is responding.
=> Create a single-select question somehwere after your HHroster

Q2: “Enumerator: Who is the respondent of this interview”.

Link it to your HHroster (“Source of Categories” needs to be “List question or question from roster group” and then bind it to HHroster.

You can now retrieve the age of the person selected in Q2 through:


Similar to discussion here, the linked single-select question Q2 has a specific data type.

q2[0] returns the value of the first element in q2. Since it is single-select, we know there will be only one element. You could also write q2.Last() or q2.First().

Use this to validate your age question. But why do you accept a difference up to 10 years? I would want that to be identical:

I.e. at question q_3: Before we begin, how old are you? you can validate:


Thanks, Peter. This is helpful. To respond to your first question: we re-ask age because it is possible that the age reported in the roster is incorrect (i.e., somebody other than the selected respondent provides the household roster and they are unsure of the ages of all household members).

1 Like

I support Peter’s comment. A person has only one age. The survey should have one answer to that question, not two. (Unless it is of specific interest how informed are hh members about the age of each other.)

When collecting the roster record who is the respondent (suppose JOHN), and age of every person (suppose MARY). Then, during individual interviews your question should be:
“JOHN has earlier said that you MARY are 27 y.o. Is this correct?”
If yes, proceed, if no - error and inform the interviewer to go to the roster and change the age of the person and answer yes to the confirmation question.

ALTERNATIVELY, and given that your age difference is 10 years - pretty significant tolerance, you may also consider to ask first “Is MARY an adult?” if yes, she is eligible for the interview, then get the age from her directly. In this case though, you don’t get the ages of the other members that are not selected.

Regarding what @vdounoucos has written (Q1.Interview - Q1.Roster)
This makes no sense. The question names must be unique in the whole questionnaire.
instead you mean mathematically speaking (ROSTER[i].rosterAge - INTERVIEW[i].interviewAge), but given that you are talking about the same person, in Survey Solutions it is simply (rosterAge-interviewAge). I believe this has been discussed extensively in the forum, see e.g. here and search throughout.