Use accumulators in a group of repeating questions

Hi everyone,

I’m developing a form to gather data about family units. One section involves repeating questions about birthdate, name, and gender for each family member. I’m looking to employ accumulators to calculate the number of males and females within each family. Your input would be greatly appreciated. Please let me know your thoughts.

Hi @segosal279,

Following approach can help you:

I added two calculate type questions inside the repeat group, to assign value of 1 to male and female choices.
Then I added two more calculate questions outside of the repeat group to SUM the values of the calculate questions inside the repeat groups.

type name label calculation
begin_repeat Family_info
select_one gender Gender Gender
calculate Male if( ${Gender} = ‘male’, 1, 0 )
calculate Female if( ${Gender} = ‘female’, 1, 0 )
end_repeat
calculate Total_Male sum(${Male})
calculate Total_Female sum(${Female})

If you need further help, don’t hesitate to ask.

2 Likes

Hi @hakan_cetinkaya . Thank you so much for your help! It was very useful

2 Likes

@hakan_cetinkaya, :bowing_man:

2 Likes