Help needed with validation!

Hi @Kal_Lam ,
I need help with the below validations.

Q0. Which level of school are you?
- Basic School (Kindergarten/Primary/JHS)
- Senior High School (SHS)
- Technical and Vocational School (TVET)

Q1. Cluster of schools( Schools on same compound with different Heads)
- Yes
- No

Q2. Number of Toilets owned by the school
= 10

Q3. Number of Toilets Accessible to students
=

Validation Rule

a. Q1 should appear for Basic School only and not for Secondary School
b. If Q1 is yes, Q3 >= Q2
c. If Q1 is No, Q3 <=Q2
d. (Yes and No validation) applies when “Q0” is Basic School, But When “Q0” is SHS or TVET (only “No” validation applies)

@theo27, sorry I did not quite understand your issue with the validation rule you laid out for d and e. Could you explain them again?

@Kal_Lam i just made changes to the last validation rule D. let me know if it is clear now. Thank you
Else help out with {A,B and C} and i might get a clue to D.

Let me give a practical example with an image

From the image,

First Validations to be set are;

  1. If Q1 is basic, then Q2 appears.

  2. If Q2 is Yes, and assuming Q3 is 20 , then Q4 should be greater or equal to Q3

  3. If Q2 is No, and assuming Q3 is 20 , then Q4 should be less than or equal to Q3

Second Validation to be set is;

  1. If Q1 is SHS or TVET, and assuming Q3 is 20 , then Q4 should be less than or equal to Q3

Validation Test Original.xlsx (6.7 KB)

@theo27, you should be able to do it as outlined in the image shared below:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Image 2

In the settings tab of your XLSForm:

Image 3

Data entry screen as seen in Enketo: when nothing is entered

Data entry screen as seen in Enketo: when the first choice is selected for Q0, Q4 is also auto activated

Data entry screen as seen in Enketo: when Yes is selected for Q1 the constraint is active in Q3

Data entry screen as seen in Enketo: when Yes is selected for Q1 the constraint is active in Q3

Data entry screen as seen in Enketo: when No is selected for Q1 the constraint is active in Q3

Data entry screen as seen in Enketo: when No is selected for Q1 the constraint is active in Q3

Reference XLSForm:

Validation Test Original.xlsx (12.3 KB)

Thank you @Kal_Lam .
Is there a way we can do away with “Validation Status” ?
Reasons.
This scenario is just a part of the questionnaire.

The other questions that follow are;

Number of Toilets Functional for the students
Number of Toilets providing Privacy to the Students

these extra two questions has to use same validations for the “Accessible Toilets” in your solution.

In this case how do i go about it?

@theo27, Validation Status is system controlled variable; hence it cannot be accessed through the Formbuilder.