XLSForms: mismatch indexed-repeat()

1. What is the issue? Please be detailed.
When executing the forms in ODK mobile, an error appears when the "Manual opening of the furrow (Without Position)" option is selected.
Error is “……XPath evaluation: type mismatch indexed-repeat(): parameter 2 must be a parent of the field in parameter 1”
Inside the XLSForms attach "xlsforms_v42b_test.xlsx" we think the error is in Row 294 or 296 but we can't find it.

2. What steps can we take to reproduce this issue?
Deploy in attached xlsform on any server, download it in mobile odk and the error appears when the option "Apertura Manual de surco (Sin Posición)". is selected in one of the screens.

3. What have you tried to fix the issue?
we did not find the error, you do not know how to solve it

4. Upload any test forms or screenshots below.

xlsforms_v42b_test.xlsx (931.8 KB)

Thank you for the great collaboration you already gave us @mathieubossaert
@aurdipas any kind of suggestion is appreciated

Thanks very much

Hi @Varo
As the message says:

parameter 2 must be a parent of the field in parameter 1

that means in indexed-repeat() function the first parameters is a question name and the second is a group name which contains the question mentioned in the first parameter. (See https://docs.getodk.org/form-repeats/#referencing-repeated-questions-from-outside-the-repeat)

Please make sure that in all places where you use indexed-repeat() function you do that in a proper way.

Thank you very much @Grzesiek2010
We have been doing some tests but we were unable to find the error. Is there someone who can give us a hand? Attached is the file containing the error.
Thank you very much

Hi Alvaro.

I took a new look at the form but I can't understand the problem...

First of all thank you very much for your comments @mathieubossaert @Grzesiek2010

We continue to analyze the issue but we cannot find the solution, but we do believe we understand the problem more.

We believe that the problem arises when in row 135 “select_one manual_tuboposi_tubosinpo” name “procedimiento” the choices name “2” is selected, label “Apertura Manual de surco (Sin Posición)”, with the other options of choices 1 or 3 working fine .

On the other hand, according to the error it shows on the mobile, the other row involved would seem to be row 475 “calculate” name “diferencia_dens_aux_surco_c” and the is this:


What we can't do is find the problem itself or the solution.

Attached a new xlsform with clearer identification of the beginning and end of groups and repeat that can help in the interpretation.
xlsforms_v42e_test.xlsx (933.2 KB)
We would greatly appreciate your comments.

The problem is that the form is pretty huge if you could remove all not related questions and keep only those that you think cause the issue then it would be much easier to help.

I've spend some time removing all unrelated questions/calculations etc and keeping only those that have something to do with that error. It looks like this:
xtest.xlsx (11.3 KB)
but I can't reproduce the issue. @Varo Please test this form.


First of all thank you very much for the collaboration.
We have already tested the form and it works perfectly in the implementation on the server (kobo) as well as in the mobile application.
On the other hand, we see that the number of repeats, the “begin repeat” and the “end repeat”, seem to be the same as the entire original form.
And also the code of the field “diferencia_dens_aux_surco_c” we see that it is the same.
@Grzesiek2010 did you make any changes?? What did you modify to make it work?
Thank you very much

I tried to modify nothing just remove unrelated elements of the form so that it's readable. I think I only:

  • hardcoded 2 in choice_filter cultivo=”2”
  • simplified some calculations by removing if statements and keeping only those elements that are relevant assuming that the answer in the select one question is Apertura Manual de surco (Sin Posición)

Please double check if I didn't change anything important if not that would indicate other questions had something to do? That would be strange.

What ODK Collect version are you using?

Hi @Grzesiek2010

Thank you very much for the aclarations. If we are going to be checking everything again and we will tell you.
So perhaps the topic is in the questions and in the code, not in the location of the repeats. Does this make sense?
We have tested it with the ODK version v2022.2.3 and with v2022.4.0 and both show the same error.
Thank you very much

It would be good to first check that small form I provided to make sure the structure of relevant elements is the same as I said analyzing that huge original version is very difficult.

Could you also tell us when that error pops up? Immediately when you select that option or when you try to navigate to the next question?

Hi @Grzesiek2010

Of course, yes, we are going to be analyzing the simplified structure in more detail and we will comment on it.

Regarding the questions. The error appears immediately when I select that "Apertura Manual de surco (Sin Posición)" option.
I see that it is a good question, I hope it helps us. What would it be indicating?
Thank you very much