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
Cheers
Alvaro

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:

if(${procedimiento}=2,pow(indexed-repeat(${sml_surco_c},${repeat_surcos_c},${conteo_c},${repeat_correccion},${conteo_repeat_correccion})-indexed-repeat(${promedio_densidad_aux_surco_c},${repeat_correccion},${conteo_repeat_correccion}),2),

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.
Cheers
Alvaro