Issues related to the summation of previous answers and limitation

Hello everyone
I am using the KoBoToolbox platform.
I have one first question Q1:how many pregnancies did you have (including stillborns, miscarriages and premature) in total? followed by the 3 Questions, Q2 how many stillborns, Q3 how many miscarriages and Q4 how many premature. I did the sum of Q2 Q3 and Q4. I would like to integrate a message or a function … the sum of Q2 Q3 and Q4 should be < Q1 if not message of error…
Thank you for your help
Sincerely, Aline

Hi,
Welcome to the community forum.

I suggest that you add a constraint script for each question using a logic that allows you to check for every step.

  1. Q2 should have constraint as .<= ${Q1}
  2. Q3 should have constraint as .<= (${Q1}-${Q2})
  3. Q4 should have constraint as .<= (${Q1}-${Q2}-${Q3})

If you are editing in XLS form, then approach below will help you sort this out.

The excel is attached here Test_06182020_2118hrs.xlsx (11.7 KB)

The behavior you will get is this:

Checks Q3 as follows
image

Check Q4 as follows
image

Wishing you all the best.

Stephane

1 Like

Hi there
Thank you Stephane for your prompt repose, so nice!
Regards
Aline

2 Likes