Does anyone know how to use the “if” statement in a form where there is or could be a repeat on the group of questions?

Does anyone know how to use the “if” statement in a form where there is or could be a repeat on the group of questions. For example, during surveys, there is a certain stop time depending on the found activity or not. So there could be 0,1,2,3,enz numbers of “activities”. I would like to add the time spend during these activities and subtract it from the total time. I succeed only in case there is 0 or 1 activity. My question is how to add any activity time IF it occurs?
Thank you

@stcb, did you mean you wanted to check out the time spent by an enumerator on a specific group of questions?

Sorry it’s a very confusing question. But I have made a group of questions within my form. Labelled “activity information” and the time is being recorded per activity (group). In the group settings, I have ticked the box “Repeat this group if necessary”. And I would like to add up the time, if there are multiple “activities”(groups). When the group is being repeated.

Could you show us a sample of what you try to mean by this?

Yes, happy to.


This is the calculation of the seperate activity.


And this is the final calculation.

All this works fine until I have another activity:

After the second activity group both calculations are off.

Hope this makes a little more sense.

@stcb, it seems like your XLSForm is also needed here.

sorry could have thought of that myself. :smiley:

@stcb, the community could help you if you shared your XLSForm instead of the screenshot. That would save our communities time. Also, please only share the relevant part so the form so that the community can invest their time in the specific issue rather than spend time understanding the entire form.

Kobo_activityform.xlsx (10.4 KB)

This is the xls. form. My problem is about the repeated group. How do I get the sum of those groups (total activity time) and subtract it from the total time spend on the patrol, to get the total survey time. (Which is total time - activity time).

Thank you.