Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity update forms currently must have the entity list attached #670

Closed
lognaturel opened this issue Nov 28, 2023 · 1 comment
Closed

Comments

@lognaturel
Copy link
Contributor

Problem description

When an XLSForm specifies an entity update, an expression to get the existing entity's baseVersion is generated by pyxform. This expression reads from the entity list that the update targets, assuming that it will always be attached. However, there are useful forms to write that could update an entity without having the entity list attached. In particular, when using barcode ids offline to identify entities, there may not be any need to query the entity list.

The issue stems from Validate because JavaRosa specifically detects instance calls on instance names that aren't defined:

Error: ODK Validate Errors:
>> Something broke the parser. See above for a hint.
Error evaluating field 'baseVersion' (${meta}[1]/entity[1]/@baseVersion): The problem was located in Calculate expression for ${entity}/@baseVersion
XPath evaluation: Instance referenced by instance(participants)/root/item/__version does not exist
Caused by: org.javarosa.xpath.XPathMissingInstanceException: The problem was located in Calculate expression for ${entity}/@baseVersion
XPath evaluation: Instance referenced by instance(participants)/root/item/__version does not exist

Steps to reproduce the problem

Try to convert a form like https://docs.google.com/spreadsheets/d/1ALphkUqVgXGBV8jmCx0wohHDXknH1q3BHFQOj16IuA4/edit#gid=1068911091

Expected behavior

Some ideas for what we could do when the entity list isn't attached:

  • set the baseVersion to 0. That will never exist because versions are 1-based and so there will always be a conflict detected
  • set the baseVersion to 1. Submissions from forms that are only ever supposed to make one update would never get conflicts but multiple updates would result in conflicts

Other information

This kind of form is only practical if the barcodes are created from entities that are already registered. Maybe it's not a hugely useful/common scenario so we could wait until it comes up to address it. It may become more practical once bulk upload is more approachable.

@lognaturel
Copy link
Contributor Author

Closing for now since there isn't an obvious action to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant