-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: make local context available in data-items loop #2304
Conversation
fields: MOCK_FIELDS, | ||
local: {}, | ||
}, | ||
thisCtxt: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because calcContext gets overridden by templateCalcService.getCalcContext()
as part of evaluatePLHString()
, the values here has no effect on the results of evaluatePLHData()
in current test cases
I found this works in general, but there is a case where somehow the first iteration of a local variable in a data-items loop is found, but next iterations are not. I thought it had to do with the presence of a display group, but that doesn't seem to be the case since this template works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm slightly reluctant to add more case handling to the template-variable service as (like you mentioned), it's already feeling pretty difficult to follow/maintain.
I've proposed an alternate fix in #2314, let me know what you think and whether there would still be use to migrate any of the tests/notes from this PR over
PR Checklist
TODO
Description
Allows rows within a data-items loop to reference local variables (#2303).
Dev notes
This feels like a hack, and adding another caveat to the template-variables service logic doesn't feel great, but it does seem to work.
NB: view the code changes for
template-variables.service.ts
with whitespace changes hidden in order to see meaningful diff.Git Issues
Closes #2303
Screenshots/Videos
debug_data_items
debug_data_items_local