Instance() is showing error in collect, you may need to use indexed-repeat()

1. What is the issue? Please be detailed.
I am using instance formula to fetch values from a csv file , which is working fine in enketo but shows an error in collect , that the field is repeated you may need to use indexed-repeat().

2. What steps can we take to reproduce this issue?
Form is attached , fetches value in enketo just fine but fails in collect.

3. What have you tried to fix the issue?
Try using odk docs, xlsform.org , odk forum previous threads, gemini as well.

4. Upload any forms or screenshots you can share publicly below.

productsxml - productsxml.csv (4.8 KB)

ODK collect (5).xlsx (8.9 KB)

This issue is discussed here: https://docs.getodk.org/collect-troubleshooting/#:~:text=the%20forum.-,XPath%20evaluation%3A%20type%20mismatch%20-%20This%20field%20is%20repeated,-¶

If you are sure product_name is unique the I suggest try using join in the lookup expression.

i had tried to use join() in the lookup expression , it does not work.

What is the error message? Confirm that you have used it correctly;

join(" " , instance('productsxml')/root/item[product_id = ${p_name}]/product_name)

yes i am using it correctly as you have told but still it only works in enketo not in collect.

ODK collect .xlsx (8.9 KB)

I have another question on the same form.
In this form i am using a
tag in one of my calculations, which is working fine in collect, but is not working in enketo. Please tell me about a break line feature which will work in enketo and collect also.

yup , its working fine , i was using [1] at the end of formula, when i removed that than its working fine in collect also.
Thanks alot