Nested repeat sum function

Dear All,
i have attached form where i have 2 nested repeat groups.
First repeat is for teachers (which is open loop it means it has no ending until i click "Do not add group) and second is for classes (based on how many classes a teacher teaches).
Now i want to sum the number of students for single teacher (one or more classes).

I am having problem when i add 2 or more teachers then a variable "sumT_student" throws an error.

please help. its urgent
Admin_form_10sep18.xlsx (108.8 KB)

Sorry it is urgent; it may be difficult to help without a little more information.

Thanks for providing the form though, that helps a lot.

What is the error that it is throwing? I've had issues with nested repeats in the past where I scrutinized my XLSForm code heavily, but could not locate an issue. I personally would not be surprised if Collect or JavaRosa might have one or more related bugs. But I never filed an issue, so I can't say that the mistake was mine or not.

Still, if you can describe when the error occurs and what the error message says, that will also help a lot.

when i add 2 or more teachers loop and want to add up the number of students in his/her classes.

it throws an error that mismatch type error. sumT_student is repeated.

Thanks. That is helpful. I remember seeing that kind of error in the past, and was baffled by it. I don't think I was able to solve it, and that was part of the reason that I changed my code from using a nested repeat, to using a different implementation.

Don't want you to lose hope, though. Maybe there's a way.

I did try to replicate your issue, but I was not able to. I created a shorter version of your form. I created 2 teachers, and it showed the total number of students at the end.

Here's my form if you want to try it out:
Admin_form_10sep18-v2-jef-short2.xlsx (58.1 KB)
Admin_form_10sep18-v2-jef-short2.xml (23.7 KB)

Thanks @Joseph_E_Flack_IV . This form is working fine.
Logically it should not give any error and it was also working fine in earlier version i made. I did some updates in my form and from then it is giving error.

Any how thanks for your effort. :slight_smile: