Question display conditions

Hello friends.
I come back to you to help me correct some consistency errors in my questionnaire relating to the identification of school children from vulnerable households in community settings in the context of the fight against Covid-19.
Indeed, my concern is at the level of the different colored lines marked in the questionnaire.
We have the total schooled child which is the sum of the schooled girls and the schooled boys declared by the head of household.
The condition I want to insert is as follows:
If the total number of children entered at each class level is equal to the total number of children in school declared by the head of the household, then the questions concerning the other class levels are not displayed,
Otherwise if the total number of children entered at different grade levels is lower than the total number of school children (in yellow)
Then display the following questions.
Diagram :

  1. Total children attending school (Reported by the head of household) = 5
     How many girls attend the CP1 class?
    1
     How many boys attend the CP1 class?
    2
  2. Total children CP1 = 3
    Ps: Total children CP1 = 3 <Total children attending school = 5 Then display the following question:
     How many girls attend the CP2 class?
    0
     How many boys attend the CP2 class
    2
  3. Total children CP2 = 2

Total children CP1 + Total children CP2 = Total children attending school = 5 Then:
Don’t show the following questions again.
This condition will take into account the questions listed below. I tried to use If conditions, but it doesn’t work
11. How many girls attend the CE1 class?
12. How many boys attend the CE1 class?
13. Total Children at CE1
14. How many girls attend the CE2 class?
15. How many boys attend CE2 class?
16. Total Children in CE2
17. How many girls attend the CM1 class?
18. How many boys attend the CM1 class?
19. Total Children at CM1
20. How many Girls attend CM2 class?
21. How many boys attend CM2 class?
22. Total Children in CM2
23. Total Primary children in the household
24. Do you have children who attend college in the 3rd grade?
25. If yes, how many girls attend grade 3?
26. How many boys attend grade 3?
27. Total Children in 3rd grade
In summary, when the total number of children enrolled in primary education in the entry reaches the total number of children enrolled above, the other class levels no longer need to be displayed, otherwise continued displayed until the quota is equal to the number of school children declared by the head of household.
I tried to make this condition using the functions (If, And, Ou) etc. but I can not. Could you give me an example that I can reproduce?
I am attaching the file so that you can guide me on the procedure to follow using a concrete example.
Test 8.xlsx (24.3 KB)

Hi @esy_cari2020,

Your condition seems extremely long. Could you please let us know the following first so that we are able to see if it’s do able in KoBoToolbox:

  • How do you plan to collect the total number of children in the class level?

Have a great day!

Thank you for the interest you have in my concern. the number of children by class level is entered by the interviewer by sex.
He collects the number of girls at CP1
Then the number of boys at CP1
The total of children at CP1 will give: $ {CP1} + $ {CP2}
I attach an image capture to the message.

Saisie dans le questionnaire

Hi @esy_cari2020,

One more question, so how do you have the following information before collecting data:

Is it always 5?

Have a great day!

Hi @esy_cari2020,

As a workout, you could use the following approach:

  • Group what you wish to skip if a certain condition is fulfilled.
  • Apply a skip logic to the group.

As a reference you could also have a look at our support article Adding Skip Logic to Your Form. For a quick reference you could also have a look at one of our forum discussions that should help you design a survey form with a a group skipping:

Have a great day!

Hi kal
To answer, I would say no, the number of children attending school is not always 5. Indeed, it is the sum of girls attending school + that of boys attending school in the household which is declared by the head of household.
I am attaching a file and an image to illustrate my concern.Test-Child School.xlsx (10.3 KB)

  1. $ {Total_CP1} + $ {Total_CP1} = $ {Total_Enfts_Scol}
    If this first condition is met, then the next question is no longer displayed;
    else if
  2. $ {Total_CP1} + $ {Total_CP1} <$ {Total_Enfts_Scol};
    Then display the next question:
    How many girls in CE1 class?
    How many boys in CE1 class?
    $ {Total_CE1} = xxx
    Here’s what I’m trying to do

Thank you Kal

Hi, @esy_cari2020,
Looking at your issue, I would recommend a different approach. First of all, the idea behind complex calculations and logic is all about thinking it through the entire way, thus allowing the logic to be first created pictorially before you try writing down codes.

Using the above example, I narrowed your logic below to simply two validation issues:

  1. At any time the cumulative total should always be less than the total number of children before the next question is created i.e. SKIP LOGIC.
  2. The number to be entered cannot be greater than the difference between the total number of children and the cumulative total.

With the above two overriding analogies, I did the following:

  1. I introduced a cumulative total after each question (see examples of cumtot1, cumtot2 etc)
  2. Added a simple skip logic feeding it from the cumtotX (where X is a number)
  3. Added a constraint also based on the cumtotX

The image below shows my approach towards solving your problem

Using the steps illustrated above you can continue to add your question then a cumtot3 to X depending on the number of questions you have. You can then add everything I have highlighted in yellow. HINT my XLS form is written using excel formulas so you can simply add your question then copy the yellow items to appropriate places and the form it will automatically add the relevant formulae

Test-Child School.xlsx (11.4 KB)

Follow the logic carefully and implement it throughout your form.

Stephane

1 Like