Referencing responses from outside the Repeat Loop

1. What is the problem? Be very detailed.
Hello Guys, 1. I'm trying to get a first Repeat Group to reference an answer from outside the Repeat Group using the indexed-repeat function but I seem to be getting an error anytime I validate the XLSForm.

  1. Then again I need a second Repeat Group to reference an answer from the first Repeat Group using the indexed-repeat function but I still get an error that says:
    "'ODK Validate Errors:
    >> Something broke the parser. See below for a hint.
    Dependency cycles amongst the xpath expressions in relevant/calculate
    Result: Invalid'
    Your file should have the .xls or .xlsx file extension because Ona uses XLS Forms to create forms."

2. What app or server are you using and on what device and operating system? Include version numbers.

3. What you have you tried to fix the problem?

4. What steps can we take to reproduce the problem?
Sample XLSForm attached.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
Screenshot attached.Logistics_StoreKeepers Insecticide Barcoding System.xlsx (482.2 KB)

Anyone figured out what I didn't do right. This is the first time I'm implementing this type of logic. Thanks in advance!!

Hi @Nana_Kwasi_Appiah
first of all welcome to the forum! Please introduce yourself here!

when it comes to your problem...

if you try to get a value which is not in a repeat group you don't need indexed-repeat function.
I don't understand what you try to achieve in calculation row 16 and 21?

Hello @Grzesiek2010 thanks for reaching out.
For row 16: I'm trying to get the repeat group [team_details] to repeat a number of times based on the integer entered for row 15 [site_teams].

For row 21: I'm trying to get that repeat group [barcode_details] to repeat a number of times based on the integer entered for row 19 [insecticides_issued]. Sort of a nested loop :slight_smile:

The idea is: If you say there are 3 teams, the [team_details] group should repeat 3 times to capture info for each of the teams, and inside the same [team_details] group, if you say you issued 10 insecticides bottles for each of the teams , the other repeat group (row 21) should reference that number per each team and repeat 10x (scan the barcode) for each of the bottles.

so what you did in column repeat_count row 16 is enough you don't need that calculation in the same row, you can remove it. Please take look here how Dynamic repeat counts work, there is no calculation using indexed-repeat.

so if you have 3 teams and in every one you answer 10 for insecticides_issued that mean you want to have 30 representations in total?

Alright, I'll take out the calculation. And I'll check on the link: Dynamic repeat counts

Correct! 30 representations in total. But each of the 10 representations should be limited to one group.

Can't you use nested repeats? Something like this (I edited your form):
Logistics_StoreKeepers Insecticide Barcoding System.xlsx (95 KB)

Great, yes I tried nested repeats earlier and also tried your edited form and like expected, I got the same errors I got before which made me go in for indexed-repeat function. See attached image.

The problem is that in settings sheet you try to calculate concat(${team_number}, '-', ${team_leader}) where team_number and team_leader are in a repeatable group. If you get rid of it everything will be fine.

1 Like

@Grzesiek2010 Ahhhh that's a smart catch!! :slight_smile: :smiley: It works! Thanks!!

1 Like