Appearance
Binding Widgets to Data
Last updated
A binding connects one input of a widget to a source of data. Most display widgets read a binding called value; charts, tables and element bindings read several.
Adding a binding
- Select the widget.
- In Data Bindings, click +. A binding named
valueis added; the next ones are namedvalue1,value2and so on. Names cannot be edited. - Choose the source: Tag, Static or Expr.
- For a tag, click Select tag and pick the device and tag in the tag browser.
In the dashboard editor, the tag browser shows each tag's current value beside its name, so you can see which tag is actually moving before you bind it. A value in amber has quality other than good; hover it for the full value and quality. A bound tag's current value also shows next to its path in the binding. The same live values appear in every tag picker in the property panel, such as Flash Alert and Chart Tags.
The binding name shows in small capitals at the top of each binding. The × removes it.
Widgets read bindings by name, so it matters which one you add first:
| Widget | Reads |
|---|---|
| Value, Gauge, Progress Bar, Status, Chart, Marquee, Barcode, Camera, Image, Toggle, Checkbox, Slider, Dropdown, Text Input, Numeric Input | value only (Chart ignores it when Chart Tags are set; Image uses it only with Image by Value) |
| History Table | The first binding |
| Bar Chart, Pie Chart, Table (tag mode) | Every binding, one bar / slice / row each |
| Symbol (element bindings) | Bindings named svg:<element>:<property>, created for you |
| History Chart, Power Chart, Alarms, Data Table, production widgets | No bindings — they have their own tag or device settings |
Buttons, Navigation, PDF Viewer, Text and Form do not read value bindings.
Source types
| Source | Use it for | Notes |
|---|---|---|
| Tag | A live tag on any device | Updates as the appliance pushes changes, typically within a second of the driver reading them |
| Static | A fixed value | Always text: a static 42 arrives as the string "42" |
| Expr | A value calculated in the browser | A JavaScript expression. The other bindings on the same widget are available by name |
| Parameter | Template editor only | See Template Parameters |
Expressions
An expression is evaluated in the viewer's browser each time one of the widget's values changes. Use the names of the widget's other bindings as variables.
A Value widget with a tag binding value1 on Oven/ZoneTemp and an expression binding value:
javascript
value1 > 230 ? 'HIGH' : 'OK'Converting a tag in °C to °F on screen (tag binding value1, expression binding value):
javascript
value1 * 9 / 5 + 32- Tag values arrive already typed:
floatandinttags as numbers,booltags astrue/false, everything else as text. - Tag and static bindings are resolved first, then expressions in list order, so an expression can use an expression listed above it.
- An expression that throws (a typo, a missing name) produces no value; the widget shows its empty state. Nothing is logged.
- A binding that has not received a value yet is
undefinedin the expression.
Bad quality and lost connection
When any Tag binding on a widget has bad quality, has not received a value yet, or the browser has lost its live connection to the appliance, the widget is dimmed and covered with red diagonal hatching. The last value stays visible underneath so you can still read it, but treat it as stale. See Tag Quality.
How live values reach the screen
Opening a dashboard subscribes the browser to exactly the tags its widgets bind. Leaving the dashboard unsubscribes. A widget inside a closed tab of a Container is not subscribed until the tab opens.
Widgets showing the same tag share one subscription, which lasts until the last of them goes away: deleting or rebinding one widget, closing a tag picker, or collapsing a folder in the tag browser leaves every other widget on that tag updating. After the browser reconnects to the appliance, every tag still on screen is subscribed again.
Values are sent when the appliance sees a change (a new value or quality, after deadband). A tag whose value never changes sends nothing new, which matters for the live Chart.
Bindings elsewhere
The same binding sources work in <scada-widget> shortcodes on custom pages, written as bind-value="tag:3/Spindle/Speed" — see Widget Shortcodes.