Constraint for single answer on the based on previous integer question

Hello!

Q1. completed age in years_______ (hint: age 0-99).

Q2. is the respondent eligible for interview? (hint: 10-19 are eligible)

  1. Yes (if age between 10-19)
  2. No (if 0-9 and 20-99 are not eligible)

Now i need to control and check by constraint for both conditions in “Q2” variable.
Could you please help me by somebody expert?

Any assistance is highly appreciated…

Dev Maharjan

Hi Dev,
This the same issue as your first question - the best approach is to not allow/require the interviewer to decide if the respondent is eligible, let Kobo do it for you - that is one of the major advantages of using digital surveys. If the interviewer has to look at the age and decide if the respondent is eligible they will always make occasional mistakes, which creates serious issues for you with data reliability and ethics.

What you should do in this case is ask q1, then put the rest of your questionnaire in a group (see the xlsform guide XLSForm.org if you’re trying to figure out how to do this), On the ‘begin group’ question put in a skip syntax (in the ‘relevant’ column) which would be
${q1}>=10 and ${q1}<=19

That way the questionnaire would only appear if the person’s age was in the 10-19 range. What I normally do is then have a question which is the very last question in the questionnaire, outside the group of questions asked to people aged 10-19, which is something like this:
name type label relevantq_not_eligible note This person is not eligible because their age is not in the range 10-19 years. Please thank them and end the interview. ${q1}<10 and ${q1}>19

That way, if their age is not eligible, the only question the interviewer will see is a note explaining they are not eligible and asking them to wind up the interview.

Cheers,

Matthew

···

On Wednesday, 12 July 2017 02:52:24 UTC+10, Dev Chandra Maharjan wrote:

Hello!

Q1. completed age in years_______ (hint: age 0-99).

Q2. is the respondent eligible for interview? (hint: 10-19 are eligible)

  1. Yes (if age between 10-19)
  2. No (if 0-9 and 20-99 are not eligible)

Now i need to control and check by constraint for both conditions in “Q2” variable.
Could you please help me by somebody expert?

Any assistance is highly appreciated…

Dev Maharjan

Dear Matthew,

As you wrote me in my second post I want to use;

If you have a good reason to get them to answer (almost) the same question twice, the problem with your syntax is that you need to use the period (fullstop) to refer to the current question when writing constraints - you could also ${q2} but ‘q2’ as you use here won’t refer anywhere - all references to questions need to wrap the question name in ${}. So the correct syntax would be something like:

(.=‘1’ and ${q1}<10 ) or (.=‘2’ and ${q1}>=10 and ${q1}<=20) or ( .=‘3’ and ${q1}>20)

Cheers,

Matthew

Great

Dev

···

On Wednesday, July 12, 2017 at 8:11:36 AM UTC+5:45, matt...@gmail.com wrote:

Hi Dev,
This the same issue as your first question - the best approach is to not allow/require the interviewer to decide if the respondent is eligible, let Kobo do it for you - that is one of the major advantages of using digital surveys. If the interviewer has to look at the age and decide if the respondent is eligible they will always make occasional mistakes, which creates serious issues for you with data reliability and ethics.

What you should do in this case is ask q1, then put the rest of your questionnaire in a group (see the xlsform guide http://xlsform.org/#grouping if you’re trying to figure out how to do this), On the ‘begin group’ question put in a skip syntax (in the ‘relevant’ column) which would be
${q1}>=10 and ${q1}<=19

That way the questionnaire would only appear if the person’s age was in the 10-19 range. What I normally do is then have a question which is the very last question in the questionnaire, outside the group of questions asked to people aged 10-19, which is something like this:
name type label relevantq_not_eligible note This person is not eligible because their age is not in the range 10-19 years. Please thank them and end the interview. ${q1}<10 and ${q1}>19

That way, if their age is not eligible, the only question the interviewer will see is a note explaining they are not eligible and asking them to wind up the interview.

Cheers,

Matthew

On Wednesday, 12 July 2017 02:52:24 UTC+10, Dev Chandra Maharjan wrote:

Hello!

Q1. completed age in years_______ (hint: age 0-99).

Q2. is the respondent eligible for interview? (hint: 10-19 are eligible)

  1. Yes (if age between 10-19)
  2. No (if 0-9 and 20-99 are not eligible)

Now i need to control and check by constraint for both conditions in “Q2” variable.
Could you please help me by somebody expert?

Any assistance is highly appreciated…

Dev Maharjan