Default integer based on previous integer input

1. Problem
I have 2 sets of 12 integer type questions:

  • "How many children enrolled " by grade & gender
  • “How many children attending on day of visit” by grade & gender

I would like to populate the second set of questions based on answers to the first set of questions (default, the user can change the number).

I already have a constraint, but it would aid the monitor very much to have this prepopulate and he/she just adjusts the numbers for grades with missing kids.

2. What you have you tried to fix the problem?

  • directly referenced the field
  • referenced the field with sum()
  • used calculations as reference (just the field, sum(field), if(field=null,0,field), using once)
  • used triggers for calculations

See the xlsform attached with everything I’ve tried so far - unfortunately nothing has worked yet :frowning:
example_school.xlsx (21.9 KB)

The ODK & Mobile Data Collection community have helped me design killer forms in the past, so hope some wonderful mind out there may have a solution :slight_smile:

Thank you!

Welcome back to the community @daria_gordina! Maybe you could do the same as outlined in the image shared below:

In the survey tab of your xlsform:

Data entry screen as seen in Enketo:

Reference xlsform:

example_school.xlsx (18.9 KB)

Hi @Kal_Lam, thanks for your quick response. Yes we already have constraints in the real form as well. However, I would like to set a default based on the previous field. This is not for better data quality (for this we have the constraint), but rather for easier data collection for monitors. So when they enter 10 boys in grade 6 enrolled; 10 boys are automatically filled for the grade 6 boys attending day of visit. This way they only need to adjust some numbers, not enter every single one