Are values in converted unit available to scripts?
-
I've been debugging a script that checks when Flow Rate exceeds 3gpm, After much confusion, I remembered that the device reports m³/h, and that data point is configured with "Convert Unit for display" checked, to convert it to "gal/min".
Converted and Rendered values are available in the dashboard data point objects, but apparently not in scripting. Is there an intrinsic method for accessing the converted value, or do I need to do explicit math in the script?
-
Hi AldoRamos,
I opened a git issue for this last time it came up on the forum, but I don't believe my suggestions were commented on or implemented: https://github.com/infiniteautomation/ma-core-public/issues/1402
I gave the way to solve this in the interim in the thread I linked to: https://forum.infiniteautomation.com/topic/3989/send-multiple-point-value-in-alarm-text/6
-
Thanks @phildunlap, that should make it much more practical and maintainable.
-
This script is based on the XID; is there a way to get the "VO" from a conext point, or do I need to start with the XID?
-
You can get the VO via the DataPointRT in the CONTEXT_POINTS array (which is that DataPointRT objects of the enabled points in the context) via:
CONTEXT_POINTS["variableName"].getVO();
-
@phildunlap Excellent! That's really useful information.