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

Error message for nodeset returned when single node expected is generally unhelpful #700

Open
lognaturel opened this issue Nov 16, 2022 · 1 comment

Comments

@lognaturel
Copy link
Member

lognaturel commented Nov 16, 2022

When a nodeset is returned but a single node is expected, the error message says "This field is repeated:" and "You may need to use the indexed-repeat() function to specify which value you want".

The most common case I see this error in is when a predicate returns multiple items for an expression used in a context that requires a single value. Another common case is trying to access a field in a repeat from outside the repeat. The intent is often to use some kind of aggregating function like sum.

The indexed-repeat hint is not useful in either of those cases. It only really applies to parallel repeats. Even then, we try to nudge form creators towards using raw XPath expressions over indexed-repeat.

@lognaturel
Copy link
Member Author

lognaturel commented Oct 25, 2024

I wrote an expression to look up a person by household id when I intended to look them up by member id. There are multiple people in the same household so I got this error.

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

No branches or pull requests

1 participant