Constraints dependent on another field

Welcome to the ODK forum, @faran_d! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a picture as your avatar because it helps build community!

The constraint is checked when the question value changes, or when the entire survey is validated before submission. This can make it confusing if the constraint for the first question cannot be fully evaluated until the second question is answered (and therefore, not until the survey is validated for submission at the end).

One option would be to move the question about age unit to before the age integer question.

In both of the above cases, you have a single column of data in your results that mixes numbers with different units. A "2" could be 2 months or 2 years. Which I think can lead to confusion during analysis.

Another option would be to ask the age category (0-23 months old or 2+ years old) and then use relevance to ask (in separate questions) either months or years. If you need a single age column, you could use a calculate type question that copies in either the years value or the months value divided by 12. Then all values in your data results for that column would be in unit of years.

I have examples of all three scenarios in this file:
constraints_example.xlsx (10.2 KB)