Appearance
Referring to a Tag Everywhere
Last updated
Every place in Scada.Ink addresses a tag as device + tag path, but they differ in whether the device can be given by name, and whether there's a picker. Get the device id from the device page URL (/devices/3 is device 3) or the Devices list.
Warning: Device ids differ between appliances. A dashboard, script or page copied to another appliance must be re-pointed unless it looks devices up by name.
Quick reference
| Where | How you choose the tag | Device given as | Example |
|---|---|---|---|
| Dashboard widget binding | Tag source → Select tag → Browse Tags picker | Picked (stored as id) | Picker: CNC Mill 1 → Spindle/Speed |
<scada-widget> shortcode in a custom page | Typed attribute | Numeric id only | bind-value="tag:3/Spindle/Speed" |
| Custom page JavaScript | scadaink.subscribe(id, path, cb), scadaink.read(id, path) | Numeric id only; a name never receives updates | scadaink.subscribe(3, 'Spindle/Speed', v => …) |
| Script | tags.read(device, path) | Number, or device name as a string (case-insensitive) | tags.read('CNC Mill 1', 'Spindle/Speed') |
| Script local write | tags.write(path, value) | Always the Local Tags device | tags.write('line1/count', 5) |
| Script device write | tags.writeDevice(device, path, value) | Number or name | tags.writeDevice(3, 'Spindle/Override', 90) |
| Script trigger (Tag Change, Tag Threshold) | Device ID box + Tag Path | Numeric id typed in | Device ID 3, Tag Path Spindle/Speed |
| Workflow nodes (Tag Change, Tag Value, Read Tag, Set Tag) | Device picker + Tag Path picker | Picked; choosing a tag also sets the device | — |
| Ladder logic | Device Tag operand → Browse | Picked; shows Device #3 / Line1/Speed | — |
| Alarm rule | Device (required) then Tag (required) | Picked; subscribed tags only | — |
| Expression tag | {deviceId:tagPath} | Numeric id only | {3:Spindle/Speed} |
Script expression.eval() | {name:path} | Device name only | {CNC Mill 1:Spindle/Speed} |
| Public Data API | tags= query | Id or name | /api/data/history.json?tags=3:Spindle/Speed&start=-1h |
| REST API | JSON body / path | Numeric id | POST /api/tags/write { "deviceId": 3, "tagPath": "…", "value": 90 } |
What the pickers list
The tag picker used by dashboards, workflows, ladder and the script Tag Snippet (title Browse Tags, search Search tags, devices, UDTs...) lists:
- Devices: every enabled device with its enabled subscriptions, Local Tags first, then Expression Tags (every enabled expression tag, device 0, path
Expression/<name>) when the Expression Tags feature is licensed; - Tag UDTs: each UDT's instances and their fields.
It does not list disabled tags, disabled expression tags, tags on disabled devices, or tags the device offers but you haven't subscribed. For those, subscribe first, or type the reference where a text form exists (scripts, custom pages, shortcodes).
Tips for portable references
- Scripts: use names.
const cnc = devices.find('CNC Mill 1');returns the id ornull;devices.localId()returns the Local Tags device id. A string of digits like'3'is treated as a name, so pass numbers as numbers. - Custom pages: look the id up at load time:
javascript
scadaink.devices.find('CNC Mill 1').then(function (id) {
if (id == null) return;
scadaink.subscribe(id, 'Spindle/Speed', function (value) {
document.getElementById('rpm').textContent = value;
});
});- Local tags in custom pages:
scadaink.devices.localId()gives the id forsubscribe;scadaink.write(path, value)needs no id. - Templates: bind template widgets to parameters instead of fixed tags, so each placement picks its own device (see Template Parameters).
Tag values in each place
- Scripts and custom pages get the cached value as a string, or
undefinedif no value has arrived yet. - Workflow Read Tag reads the cached value; it does not poll the device.
- Alarm rules and Tag Value workflow triggers compare numbers;
true/falsecount as 1/0 and other text is ignored. - Dashboards convert values for display according to the widget.
See Script API Reference, Custom Page API, Widget Shortcodes and Workflow Input/Output Nodes for the full APIs.