Scripting
Mango includes a built-in JavaScript (ECMAScript) engine that allows you to write scripts for a variety of purposes. Scripts can calculate derived values from existing data points, perform automated control actions, and extend the platform's functionality without writing Java modules.
Scripting is used in several areas of the Mango interface:
- Meta data points -- Compute a value from one or more existing data points using a script. The script result becomes the meta point's value.
- Scripting data sources -- Run a script on a cron schedule that can set values on multiple data points simultaneously.
- Event handlers -- Execute a script in response to an event (alarm) occurring or returning to normal.
- Global scripts -- Define reusable functions (such as unit conversions or aggregation helpers) that are automatically available in all other script contexts.
In This Section
- Scripting Overview -- Introduction to meta data points and scripting data sources, including how to create and configure each type.
- About Mango JavaScript -- The script execution context, Point Value Time objects, timestamp fields, and built-in global functions.
- Global Scripts -- How to define reusable functions that are shared across all script contexts, with simple examples.
- Script Examples -- Practical script examples including smoothness calculation, bulk event detector creation via JsonEmport, and more.