Error in indefinite repeat group inside another repeat group

Hello. I need to register several structures and each one with its materials and quantities that form it. But when generating the xml the following error appears: Error: b'ODK Validate Errors:\n>> Something broke the parser. See above for a hint.\njava.lang.IndexOutOfBoundsException: Index: 1, Size: 1\n\nThe following files failed validation:\n${indefinite-repeat-inside-other-repeat}.xml\n\nResult: Invalid'

I leave an example file

indefinite-repeat-inside-other-repeat.xlsx (9.5 KB)

There seem to be problems in Collect with how complex expressions in nested repeats are evaluated. These are being explored currently (e.g. How to count repeats in a inner field - #7 by ggalmazor).

In the mean time, I would encourage you to either ask the user ahead of time for a count of values for the inner repeat or let them add the new instances of the inner repeat as long as they have new ones to add.

1 Like

Hi @LN,
i have implemented your solution from here: XLS form- Repeat select_one question until "A" is selected - #12 by LN
if (${count} = 0 or /indefinite-repeat/person[position()=${count}]/choice != 'a', ${count} + 1, ${count})
[/quote] into a repeat group - works a charm - thank you, once again...

It does not work for breaking a repeat group within a repeat group......am i asking too much to think there is a way to do that?

both the outer and inner repeats are indefinite. The form works fine when using the "Add Group" dialogue but i end up with a double-dialogue: selecting "Do Not Add" for the inner repeat means you get instantly faced with the outer repeat's "Add Group" dialogue = nasty! :face_vomiting:

i'm guessing i hit the problems outlined here.
If so, no drama. i can side-step a bit of visual vomit until a solution is developed.

Yes, that sounds exactly right. Using an indefinite repeat for the outer one should work fine but it's the inner one that Collect has problems with.