Event Handler Setting Meta Point Failing
-
While I have contemplated making meta points that don't have execution conditions (would be useful to hit 'refresh point value' on, as that can also trigger the meta script), I haven't yet. So, either your meta point has a point in its context that has 'update context' checked and that triggers the meta points execution, or you have the update event set to something other than context update and it's executing at some specified rate or cron.
-
Ah, screenshots. You probably want to change that script body to
return UNCHANGED;
or use a virtual point instead. Currently I would expect it gets a value of 0 (casting a null return value to a numeric) every time that context point updates. -
Putting
return UNCHANGED
worked!Just a follow up questions so we don't have to bug you as much in the future:
Can you provide us some guidance on where to find documentation on virtual points?
How does a virtual point differ from an meta data point?
Thanks again for all of your hard work in helping us get this working.
-
Certainly! Sorry you were inconvenienced by the queuing issue!
Alas the documentation is scattered around the forum primarily, although the context help (blue ? next to the data source name on the edit page) is useful. Virtual points are perhaps the simplest of points. You can disable polling on the data source, and then they're just points to set values into. The data source can also poll to make the points do simple things like increment, generate random values, alternate, or whatever is sensible to the data type.
Meta points are event-driven timer-driven script bodies that are an iceberg of features with limitless use cases somewhat described here: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/web/WEB-INF/dox/mangoJavaScript.htm
I have posted a great many examples of meta points and scripts around the forum.