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

Indicate which sheet a ${} replacement error comes from #714

Open
lognaturel opened this issue Jul 22, 2024 · 1 comment
Open

Indicate which sheet a ${} replacement error comes from #714

lognaturel opened this issue Jul 22, 2024 · 1 comment
Milestone

Comments

@lognaturel
Copy link
Contributor

Software and hardware versions

pyxform v2.0.3

Problem description

I started an instance expression with ${ (${instance('filename')/root/item). Naturally, that doesn't work so I got an error: There has been a problem trying to replace ${instance('filename')/root/itemwith the XPath to the survey element named 'instance('filename')/root/item'. There is no survey element with this name.

This was on the entities sheet so it took me a while to find. It's not the first time this has happened to me. It has also happened from the settings sheet because I sometimes write an instance_name expression and then change the form structure without updating that expression.

Steps to reproduce the problem

Include a badly-formed ${} expression on the entities or settings sheet.

Expected behavior

There's an indication of the sheet the error is coming from.

Other information

Things you tried, stack traces, related issues, suggestions on how to fix it...

@lindsay-stevens
Copy link
Contributor

The case shown above would be caught by the syntax check in #734. However for a syntactically valid placeholder / reference, the error message doesn't say which sheet the bad placeholder is in, so this could be improved. e.g.

| survey   |         |           |         |
|          | type    | name      | label   |
|          | text    | id        | Tree id |
| entities |         |           |         |
|          | dataset | entity_id |         |
|          | trees   | ${idx}    |         |

Raises

ERROR: 'There has been a problem trying to replace ${idx} with the XPath to the survey element named 'idx'. There is no survey element with this name.'

@lognaturel lognaturel added this to the Next milestone Oct 30, 2024
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

2 participants