-
Notifications
You must be signed in to change notification settings - Fork 137
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
Calculation using node from nested repeat has absolute reference #453
Comments
When you say "in this case", you mean with this structure regardless of the usage, right? And so then if a user actually wanted to get the sum of all Let me try to generalize a little bit. Let's say there's an expression with a |
Yes, indeed. It seems that would nearly always be the intention, so best to make that the rule (and require the user to use a manual absolute path (or the different relative path you mentioned, or
Thanks for trying figure out the rules for this. In terms of implementation are we trying to somewhat minimize the number of relative paths in the output? If so, then I wonder if for any If not, everything could be a (shortest-route) relative path, always? Would that actually simplify pyxform? |
I don't know? 😄 I think it would look strange to have relative paths from top-level nodes but maybe it doesn't matter? Your shortest-route option would mean we might end up with something like |
It feels quite radical to make everything relative, but rationally, I guess it should be fine. It might even have a minor performance improvement since the context node has to be looked up anyway, and searches from there will often only be a few steps up/down/sideways. Maybe we could let it be directed by whoever implements this? If it simplifies the code to make every ${node} reference relative, go for it and otherwise do:
|
@sadiqkhoja and I just talked through a form with exactly this shape and I was sure @lindsay-stevens when you get a chance could you please see what you think the level of effort might be (like maybe spend an hour or two on it and back out if it's looking like it will take much longer)? Nested repeats are not super common so if it's a huge undertaking it may not be worth it. If it's not as complicated as I thought when I looked at it, it would be a nice improvement for those who write forms like this. |
@lognaturel as of pyxform 2.2.0 the behaviour is still the same. This XLSForm:
Produces a match for:
Maybe there is a quick fix for this but I am not super familiar with this part of the pipeline. It seems a bit confusing, I mean from indexed_repeat_relative_path_args_index = [0, 1, 3, 5] So it would take me a little while to fully understand how this part of the pipeline works now. Then I would probably want to try and untangle the iteration (for performance) and/or replace with the newer parser (for consistency). Or work out the correct relative XPath from the Survey object tree directly, rather than e.g. parsing an XPath that came from a placeholder/reference substitution (because in order to do that substitution the XPath is calculated from the objects). |
Agreed.
This is related to I see there's at least one bug related to Thanks for taking a look! Let me take this out of the |
The output for the calculation is (which sums all species_nb question in the form) :
In this case it would be safe to assume the users wants to sum only the
species_nb
inside an instance of the higher leveleach plot_registration
repeat.Hence the output should be:
The text was updated successfully, but these errors were encountered: