Controls
Controls: Output Script
The Output Script control is an enhanced version of the Output Basic control, providing users the ability to display dynamic data with the added flexibility of custom JavaScript scripts. This control allows for the manipulation or transformation of data before displaying it, offering greater customization for real-time or calculated content.
Key Features:
-
Custom JavaScript Integration: Unlike the Output Basic control, the Output Script control lets you add custom JavaScript to manipulate or process data before it’s displayed. This gives you full control over how data is presented.
-
Dynamic Data Display: Just like the Output Basic, bind the Output Script control to a variable (e.g., CODESYS structure or other fieldbus connections) to show real-time data. The added script allows you to format, calculate, or transform this data before it’s shown.
-
Flexible Formatting: Customize how data is displayed by using JavaScript to change the text, style, or format based on the value of the connected variable. This could include conditionally changing the display color, applying mathematical functions, or formatting the data (e.g., displaying a value with decimal places, or adding unit labels).
-
Enhanced Functionality: Take advantage of JavaScript’s capabilities to create complex, conditional logic for your display. For example, you could show different messages depending on a value, apply thresholds, or even trigger actions based on specific data inputs.
Use Cases:
-
Data Transformation: Perfect for scenarios where the raw data needs to be transformed before being displayed.
-
Conditional Display: Display different content or styles based on the value of a variable. For instance, you could change the color of a text output to red if a temperature exceeds a certain threshold, or show a warning message if a machine status is "Error."
-
Complex Calculations: Use JavaScript to perform real-time calculations based on multiple variables, and display the result in the Output Script control. This is useful for more advanced applications like calculating averages or running totals.
The Output Script control offers a powerful way to enhance the functionality of your HMI by combining dynamic data with custom logic, allowing for a truly personalized and interactive user experience.