Appearance
Button Widget
Last updated
A button that does one thing when pressed: write a tag, run a script or workflow, enable or disable one, run a data-changing named query, start or stop a ladder task, or open a template popup.
Buttons are disabled in Edit mode. Use Preview in the editor to try one.
Settings
| Setting | Shown for | Description | Default |
|---|---|---|---|
| Button Label | all | Text on the button. Blank uses the widget title | "Click" |
| Color | all | Button color | #3b82f6 (blue) |
| Action | all | Write Tag, Script, Workflow, Ladder Task, Named Query (write), Open Template Popup | Write Tag |
| Write Tag | Write Tag | The local or device tag to write | none |
| Write Value | Write Tag | The value written, as text | "1" |
| Script | Script | Which script | none |
| Workflow | Workflow | Which workflow | none |
| Do What | Script, Workflow | Run now, Enable (allow triggers), Disable (stop triggers) | Run now |
| Query | Named Query (write) | A named query that modifies data, and its parameter values | none |
| Ladder Task | Ladder Task | Which task | none |
| Do What | Ladder Task | Start scanning, Stop scanning | Start scanning |
| Template | Open Template Popup | Which template, and its parameter values | none |
| Parameters | Script, Workflow | Values passed to the run (below) | none |
| Confirm before action | all | Asks "Execute: label?" first | off |
| Show result after running | all | Shows the outcome under the button | on |
Who can press what
The button checks nothing itself; the appliance checks the request. Pressing a button the user may not use shows the refusal in red under the button (when Show result is on).
| Action | Needs |
|---|---|
| Write Tag | operator, editor or admin; for a device tag, Allow Tag Writes on the device and the tag's write security level |
| Script, Workflow — Run now | operator, editor or admin, and run permission on it if it is restricted |
| Script, Workflow — Enable / Disable | editor or admin, and edit permission |
| Ladder Task — Start / Stop | operator, editor or admin, and run permission on it if it is restricted |
| Named Query (write) | A role in the query's allowed roles (admin always) |
| Open Template Popup | anyone who can view the dashboard |
Warning: An operator can run any script or workflow, and start or stop any ladder task, that is Open — from a button or straight from the API. To keep one to a few people, switch it to Restricted and grant run to those users (see Per-User Feature and Resource Access). An operator still cannot edit, enable or disable any of them.
Write Tag
Writes Write Value to the chosen tag, a local tag or a device tag. The value is sent as text; a local tag stores it using its data type, and a device converts it for the tag. The result reads Written; a refusal (for example "Write access is not enabled for this device") shows in red instead. See Writing Tags.
Script and Workflow
Run now runs it immediately, even if its triggers are disabled.
- A script run always waits for the outcome: Completed, or the script's error.
- A workflow run waits for the outcome only while Show result after running is on. With it off, the button returns at once and nothing is shown.
- Disable turns off the triggers so nothing fires it again. A run already in progress finishes normally. Enable turns them back on. The result reads Enabled / Disabled.
Parameters
Click Add for each parameter, type a Name, and choose Value (typed in) or Tag (picked with the tag browser). A tag parameter is read by the appliance at the moment the button is pressed, from the latest value it holds for that tag.
- In a script, a parameter named
setpointiscontext.params.setpointand alsocontext.setpoint. See Script Triggers. - In a workflow, it becomes a variable: any node field can use
{{setpoint}}. See Workflow Variables. - Typed values arrive as text:
"42", not 42.
Named Query (write)
Only enabled queries that modify data are offered. Fill in the parameter boxes under the query. The result reads "Rows changed: n" — 0 is worth noticing, it means nothing matched. See Named Queries.
Ladder Task
Start scanning / Stop scanning takes effect immediately; the result reads Started / Stopped. See Running Ladder Tasks.
Open Template Popup
Opens the chosen template in a window over the dashboard, with the parameter values set here (a button has no clicked machine to take them from). Nothing is shown under the button. See Drill-Down Popups.
Result feedback
While a request runs the button reads "Running..." and cannot be pressed again. The outcome stays under the button, green or red, until the next press. Hover a long message to read it all.
Example: an operator "Start Batch" button
- On the Local Tags page create
Line1/StartBatch(Integer). - Add a Button: Button Label
Start Batch, Action Write Tag, Write TagLine1/StartBatch, Write Value1, Confirm before action on. - Create a script with a Tag Change trigger on the Local Tags device and
Line1/StartBatch:
javascript
// Runs every time the button writes the tag (even the same value again)
if (context.value === '1') {
tags.writeDevice('Mixer-PLC', 'Cmd_StartBatch', 1);
log('Batch start requested from dashboard');
}The operator's press is an ordinary local-tag write; the script runs as the system and sends the command to the PLC (the PLC device needs Allow Tag Writes). You could also point the button straight at Cmd_StartBatch on the PLC, or use Action Script. Going through a local tag lets the script decide whether a start is allowed right now.