XPathMissingInstanceException when counting a filtered Entity List

I am trying to upload a form to Central with the calculation
count(instance('farmers')/root/item[farmer_community=${farmer_community}]) and it fails with the error shown below.
I thought creating the entity list (without the attributes) could help the situation but that didn't.

What I'm trying to do is to count the number of entities from a specified community and increment the value by 1 to be used as an "ID" for the new entity being created. Is there a better way to do this?

Can you please share the XLSForm? This looks similar to this thread though:

1 Like

I'm wondering whether in this specific case the issue could be that you didn't explicitly attach the farmers Entity List. Currently you need to explicitly attach even the Entity List that a form creates or updates Entities in. You can do this with a csv-external question type that has name farmers and learn more in the docs.

We've seen a number of users get tripped up by this so we are thinking about the best way to improve it.

1 Like