Calculating inside a loop

Hi All,

Am doing a project which requires to calculate number of caregivers in a home(this is a loop).
Based on the number of children under each care givers I will need to do another loop for the children under each caregiver.
Is it possible to have 2 separate loops but the total sum in the 1st loop acts as the control for the 2nd loop and I will also need to pull in the names of the care givers into the 2nd loop so as to know how which child belongs to which caregiver.
After establishing the no of children I will then need to do a 3rd loop with some questions for each child pulling their names(if possible also the caregiver) in the 3rd loop so as to know which child is being referred to.
Unfortunately this is the approach required as opposed to loop with a loop within a loop.

Looking forward to any help I can get.

Regards,

PN

Hi @PaulN,

See an example on how to calculate inside a repeat group:

In the survey sheet:

image

In the choices sheet:

image

2 Likes

Hi, i have a kind of similar scenario, please help me.

I have a question that ask for the number of children , i expect an answer let’s say 4
I then have a question that follows the first question where the respondent breaks down the number of children which is 4 into respective age groups.

Lets say
0-4 yrs 1 child
4-10 yrs 2 children
11-15 yrs 1 children

15 yrs 0

I need to ensure that the age group division is correct , that is the sum of the children in question 1 is equal to the total in the individual groups.

Any help on how i can implement the above?

Thanks

Hi @Kal_Lam,

Thanks for the sample.
Quick question;
If I wanted to save the calculation into a type: integer so as to use it for the 2nd repeat loop.

Regards,

Paul

Hi @billy_1,

Your query should be solved from the post that i replied earlier:

Hi @PaulN,

Your calculation should be saved in the integer question type. Please download the data-set in xls version. You will see the variable there which you are able to use for the second repeat loop as well.

Hi

Please resend the excel as I only have a screenshot.

Regards,

PN

Hi @PaulN,

See the attached xlsform: Household (Count) Repeat Example.xlsx (37.0 KB)

Thank you for the feedback.

1 Like

Dear all, I am a new beginner for this tool; I am developing a simple form for data verification as monitoring tool to ensure the data consistent between field recording and reporting number to office. I am stuck in processing to create data sum up of 3 months for verification purpose. Please see examples of verification here.

I am looking forward to hearing your advice or supports.
My best
Vuthea