-
Notifications
You must be signed in to change notification settings - Fork 265
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
JEXL. Use the result of calculated attribute in another calculated attribute #4556
Comments
This is not a good idea, as we could want intermediate attribute calculation that we don't want to get included in the notification. It would be better to have orthogonal mechanism: the one to specify which attributes include in the notification (that is, existing |
Proposal1:
So c1, c2, etc, can be used in the ngsi|json|payload. Proposal2:
improves proposal1 to specify an order of evaluation (so c2 could use c1 in the JEXL expression), as the cost of a more complex syntax (preCalculations is a draft name... maybe it could be improved) |
Let's go for proposal2 |
Adding a In order to avoid such complexity,
Expressions would be evaluated in increasing |
PR #4590 |
Is your feature request related to a problem / use case? Please describe.
After the implementation of #4004, JEXL is supported in custom notifications. However, a calculated attribute cannot be used in the expression of another calculated attribute.
Note that other platform components (IOTAs in particular) implement this feature.
Describe the solution you'd like
Each time an attribute is calculated, it's added to the existing JEXL context, so it can be used by attributes calculated in sequence.
In order to to this, we have to define the order in which the attributes are processed. Different from IOTAs (in which attributes come in an array, so we can base in the array order), the
ngsi
(orpayload
orjson
) fields in subscription doesn't allow to define an order.However, we could base that order in
attributes.notifications.attrs
(which is an array). This field is optional, but would become needed in the case user want to take advantage of this new functionality.Describe alternatives you've considered
None
Describe why you need this feature
The text was updated successfully, but these errors were encountered: