Skip to content

Script Text

Script Text displays an evaluated string, including units, decimal formatting, conditional wording or multiple values.

TextDocumentation revised: 2026-10-21

Text: Script Text

Script Text displays an evaluated string, including units, decimal formatting, conditional wording or multiple values.

Overview

Script Text is under Behaviors → Text. Bind it to a text box or text-capable shape; Display Text determines the content. Use Tag Text to display a single Tag.

Field configuration

Setup Script prepares data, Display Text returns the string and Condition controls execution. Place each example part in its labeled field. Clear the default Setup Script if no preparation is needed.

  • Setup Script: preparation area. Read tags, define variables, compute intermediate values (can be multi-line).
  • Display Text: return the string to display.
  • Condition: true applies the text; false skips the behavior.
  • Use quality outline colors: apply the Good or Bad border color according to communication quality. The border does not represent the process value or alarm state.
JavaScriptJavaScript
// Setup Script
var pressure = ReadTagDouble("PLC_LINE01.AIR01.PRESSURE", 0.0);

// Display Text
"Pressure: " + pressure.toFixed(1) + " bar"

When to use it

Use for formatted or combined dynamic information.

  • Show a measurement with units and fixed decimals, e.g. "Pressure: 3.2 bar".
  • Combine several tags into one line, e.g. "Pump1 RUN / Speed 1450 rpm".
  • Output different wording by condition, e.g. "Running" when on, "Stopped" when off.

Troubleshooting

The Display Text field is an expression position that returns a single value, not a full script.

  • Do not put fetch, setTimeout, or other async code in Display Text; it needs an immediate value; put such logic in a script body like Page Script/Click Script.
  • Keep heavy reads and calculations in Setup Script; let Display Text only do the final assembly.
  • Always read tags with a quoted tag name and a fallback, e.g. ReadTagDouble("PLC_LINE01.AIR01.PRESSURE", 0.0); avoid bare tag-like text.
  • The quality border represents communication quality (good/bad), not the process state.
Script Text behavior editor
Figure 1: Script Text editor

Read tags and compute in Setup Script, then return the final string to display in Display Text.

Click the image again or press Esc to close