Skip to content

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 ​

SettingShown forDescriptionDefault
Button LabelallText on the button. Blank uses the widget title"Click"
ColorallButton color#3b82f6 (blue)
ActionallWrite Tag, Script, Workflow, Ladder Task, Named Query (write), Open Template PopupWrite Tag
Write TagWrite TagThe local or device tag to writenone
Write ValueWrite TagThe value written, as text"1"
ScriptScriptWhich scriptnone
WorkflowWorkflowWhich workflownone
Do WhatScript, WorkflowRun now, Enable (allow triggers), Disable (stop triggers)Run now
QueryNamed Query (write)A named query that modifies data, and its parameter valuesnone
Ladder TaskLadder TaskWhich tasknone
Do WhatLadder TaskStart scanning, Stop scanningStart scanning
TemplateOpen Template PopupWhich template, and its parameter valuesnone
ParametersScript, WorkflowValues passed to the run (below)none
Confirm before actionallAsks "Execute: label?" firstoff
Show result after runningallShows the outcome under the buttonon

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).

ActionNeeds
Write Tagoperator, editor or admin; for a device tag, Allow Tag Writes on the device and the tag's write security level
Script, Workflow — Run nowoperator, editor or admin, and run permission on it if it is restricted
Script, Workflow — Enable / Disableeditor or admin, and edit permission
Ladder Task — Start / Stopoperator, 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 Popupanyone 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 setpoint is context.params.setpoint and also context.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 ​

  1. On the Local Tags page create Line1/StartBatch (Integer).
  2. Add a Button: Button Label Start Batch, Action Write Tag, Write Tag Line1/StartBatch, Write Value 1, Confirm before action on.
  3. 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.

See also ​

Scada.Ink Help Center