I'm trying to select how to view back on a tag's history using a Time series chart with a tag history binding. I want to change the time increments using a dropdown selector. This is the expression I'm trying to use for the start date:
The chart doesn't update when I change the unit on the dropdown.
Hi, mmaline, and welcome to the forum. Please see Wiki - how to post code on this forum. You can post a screenshot too if it provides context.
Note that Expression Language ignores multiple whitespace and line breaks (unlike Python / Jython) so you can wrap and indent the expression to make it more readable. You can also resize the window. (You've cropped the code.)
It might help spot an error if you copy the dropdown's options
properties and paste that too, formatting in the same way.
Also, be aware of the now()
expression function syntax.
now() // retriggers at the default tag group rate (typically 1000 ms).
now(0) // is evaluated once. This could be part of your problem.
now(1234) // is evaluated every 1.234 s.
What makes you think dateArithmetic
is the cause ?
Show us more of what you're doing, so we can get a better picture.
dateArithmetic(now(0), -1, {../Dropdown.props.value})
That is the tag history binding and the expression I'm using for the start date. When I try to input the data in this way it won't populate anything, so I'm probably doing multiple things wrong.
This is were the binding is in the component properties. I can get the data I'm looking for if I statically set the time increment to 'hour' or "hour" along with the other valid time increments.
You've posted part of the chart's series
property.
Post the dropdown's options
properties correctly formatted as code.
[
{
"value": "\"hour\"",
"label": "Hour"
},
{
"value": "\"day\"",
"label": "Day"
}
]
That is what I have for the dropdown's options
properties
Why the \"
?
Try without them.
2 Likes
Thanks for your help! That's what I was doing wrong.