-
Notifications
You must be signed in to change notification settings - Fork 139
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
${} references in predicates not being expanded using current() if the expression contains a space before the reference #531
Comments
@gushil - Please look into this issue. |
It seems like any item reference that is within square brackets [] should be expanded in this manner, but I don't know if there is more to it than that. |
There can also be a predicate on a nodeset expression within the primary instance. In that case typically the expression is intended to be in the context of the nodeset expression. I think "any reference in a path expression that starts with |
Yes, that is the problem (regex is disconnected if there is space found in the expression) I found. From the test case ( Should we check reference path that is begins with instance and has operators before it? note: I asked @pbowen-oc and operators that is possible are: =, !=, >, <, >=, <=, +, -, *, div, and, or |
Is there currently a regular expression that will correctly return all of If not, I'm not as sure. Explicitly testing for all of the operators really seems like a pain. It also wouldn't catch diabolical things like |
Yes, there is one. I've tried that one and successfully return all the string.
Yeah, that is what I've been thinking. Let me do the experiment with regular expression more. |
Oh good, that sounds promising!
Yes. |
@lognaturel I created PR #536 to fix the issue. Waiting for review/resolve. Thanks! |
Just bump this issue (with accompanied PR) in case the notification is missing. Thanks. |
Ok, thanks. I'll try to break it! |
Software and hardware versions
pyxform v1.5.0
Problem description
Item references in instance() expressions are not being expanded using current() if the expression has a space preceding the item reference at any point. The update for issue #490 did not address this issue fully.
Steps to reproduce the problem
Create a form with an instance() expression containing an item reference in a predicate. If the expression contains a space before the reference, it is not expanded with current and will therefore not work as intended.
Test form with several cases:
instance reference test_small.xlsx
Expected behavior
All item references in instance() predicates will be expanded using current().
Other information
I tried the attached test form in the online converter and it returns an error: "XPath evaluation: unsupported construct [filter expression]".
I converted the form internally with the validation step turned off and see that the XForm is converted with the expressions like this:
calculate="instance('clinicaldata')/ODM/ClinicalData/SubjectData/StudyEventData[@StudyEventOID='SE_E1'][position()= current()/../int1 ]/FormData[@FormOID='F_F1']/ItemGroupData[@OpenClinica:ItemGroupName='group1'][position() = ../int1 ]/ItemData[@OpenClinica:ItemName='item1']/@Value"
The first reference to item int1 is expanded as expected, but the second reference (after the expression has contained a space) is missing "current()/".
The text was updated successfully, but these errors were encountered: