Screen parameters
Migrated page, not yet verified against the current code. Treat values, paths and examples as indicative until this notice is removed.
A screen’s parameters let one screen stand for many plant stations. How to use them: Reusable screens with parameters.
Syntax
Section titled “Syntax”| Written | Is | Replaced by |
|---|---|---|
{Pump} |
a parameter | its value, else its declared default; with neither it stays as written |
{Pump|Plant/Processing/Pumps/P100} |
a parameter with a default in place | its value, else Plant/Processing/Pumps/P100 |
{Plant/Processing/Mode} |
a tag reference (expressions) | never replaced |
{UDT.Speed}, { return 1 } |
not a screen parameter | never replaced |
- A parameter name is a letter, then letters, digits or
_, at most 32 characters. It has no/: anything with a/(that is not a parameter with a default) is a tag reference. - The default after
|may hold/. It may not start with|, so{a||b}in an expression is not a parameter. - There is no logic: no conditions, loops or filters. A value is inserted as text, once; a value is never read as another parameter.
{Name} works in every text of a screen: tag paths of bindings and actions, expressions and conditions, interlocks, confirmation tags, input objects’ tag, minimum and maximum tags, alarm-object filters, trend pens, texts and the popup title. Scripts (a startup script, Run script) are not substituted: they read system.params.get('Name') and system.params.all(), which are read-only.
The server and the browser use one tokenizer, tested on the same corpus (web/testdata/screen_params_corpus.json).
Declaration
Section titled “Declaration”Display Settings > Parameters, stored in the screen as screen_params.declared:
| Field | |
|---|---|
name |
The parameter name. |
description |
For the engineer. |
type |
tagFolder (letters, digits, _ . - and /), text, or number. |
required |
The screen does not open without a value (a default counts). |
default |
The value when none is given. |
allowed_values |
The only values accepted. |
allowed_pattern |
The folders accepted: a tag path where * stands for part of one folder name (Plant/Processing/Pumps/*, Plant/Processing/Pumps/P1*), and a whole ** segment for one or more folders (Plant/Processing/**). |
A declaration with a bad name, a duplicate, an unknown type, a bad pattern, or a default or allowed value with a wildcard is refused on save (400).
Parameter sets
Section titled “Parameter sets”screen_params.sets: named value sets ({"name": "P-101", "values": {"Pump": "Plant/Processing/Pumps/P101", "Label": "Feed pump P-101"}}), edited in a grid with CSV import and export. CSV: a set column, an optional description, one column per declared parameter (comma, semicolon or tab separated).
Opening a screen with parameters
Section titled “Opening a screen with parameters”The values a screen opens with are: the declared defaults, then the set, then the values given beside it.
| From | How |
|---|---|
| A Navigate or Open popup action | Parameter set of the target screen (param_set) and / or Parameters (params, Name=value lines). A value may pass the current screen’s own {Name} down. |
| The runtime address | /runtime/<screen>?set=P-101, /runtime?screen=<screen>&set=P-101, ?Pump=Plant/Processing/Pumps/P101 |
| A script | system.nav.navigate(target, params, {set}), system.nav.openPopup(screen, {set, params}), system.nav.loadInnerDisplay(screen, container, {set, params}), system.nav.swapInner(container, screen, {set, params}) |
| A dock, an embedded (inner) screen | It gets the page’s values for the parameters it declares (all of them when it declares none), plus its own. |
Checks
Section titled “Checks”A value:
- has at most 256 characters, no wildcard (
* # + >), no brace, no control character, no.or..folder; - from the address or a script: only letters, digits, spaces and
_ . - / : ,(nothing that could become code in an expression or markup in a text).
On a screen that declares parameters:
- an undeclared name, a missing required value, a value of the wrong type, and a value outside the allowed values or folders are refused;
- an unknown set is refused.
A refused screen does not open. The runtime shows the reason and buttons for the screen’s sets. A popup does not open and the action reports why.
Server enforcement
Section titled “Server enforcement”The write policy (confirmation, e-signature, limits, interlocks) of a screen that declares parameters is derived:
| The parameter has | The server enforces |
|---|---|
| a set | each set’s expanded targets exactly, with that set’s interlock, confirmation and limit tags (sources marked param_set: "set P-101") |
| allowed values (every parameter of the screen) | every combination of allowed values exactly (at most 256), and nothing else |
| allowed folders, or nothing | besides the sets, the target as a pattern: {Name} matches the allowed folders (Plant/Processing/Pumps/[A-Za-z0-9_.-]*), or any text without them (lint param-target-unbounded) |
- For a tag a set writes, the same object’s pattern is left out: the set’s own interlock and confirmation tags decide, not the pattern’s unresolved
{Pump}/Fault. - For a value in the allowed folders but in no set, the pattern applies: the button’s confirmation or signature is required. An interlock that uses
{Name}is evaluated per value: the server reads the parameters from the tag path being written and fills them in (a write toPlant/Processing/Pumps/P107/StartchecksPlant/Processing/Pumps/P107/Fault). A filled-in interlock tag that does not exist reads as a Bad value and refuses the write. A limit tag that uses{Name}refuses every write (fail closed). Define every station as a set. - A set its own declaration refuses is not derived (the runtime never opens it); it is listed as unresolved in the write-policy listing.
- An interlock with a
{...}that the command’s tag path cannot fill in (a parameter the tag path does not have, or a brace that is not a parameter) fails closed: the server refuses every write of the command, unless If the interlock reads a Bad value is Allow, where it never blocks. An expression interlock is filled in only when every value is a plain tag path; otherwise it is enforced on the screen only, and it never lets a value past another object’s interlock on the same tag. A button that writes an exact tag (Line/Start) with a{Pump}interlock is decided by the derived sets, each with its own filled-in interlock; the interlock of the screen as designed does not open them. The Studio badge is judged with the tags the object writes. The lint names each case (interlock-parameter,interlock-per-parameter). See Interlocks with a parameter. POST /api/tags/writetakes the screen a write is sent from:screen,param_setandparams(all optional). The operator runtime sends them for every write from a screen or popup opened with parameter values. Whenscreenis given, the write is refused with403{"status": "parameters_refused", "code": "WRITE_DENIED_SCREEN_PARAMETERS", "reason": ...}, journaled, when that screen does not exist or does not admit those values. A write withoutscreenis checked as before. NATS commands and assistant setpoints carry no screen.
Designer
Section titled “Designer”- Preview with: none, a set, or custom values. Bindings and conditions use them; the resolved-tags grid lists each
{Name}reference, its resolved tag and live value; Open in the runtime opens the screen with them. - An object whose binding uses a
{Name}without a value shows a violet{Name}chip. A button whose target keeps an unresolved{Name}sends nothing. - Lint:
param-undeclared,param-unused,param-set-missing-required,param-set-value-not-allowed,param-target-unbounded(see the lint rules). - Find where used on a tag lists the screens that reach it through a set. Find and replace (Look in: Tag path, a whole path) lists them too, as “through set P-101” rows that are never applied: change the value in the set.
Behaviour changes in this version
Section titled “Behaviour changes in this version”- New: screen parameter declarations and sets, the runtime address
?set=, and the per-set write-policy derivation. - A parameter name is now
[A-Za-z][A-Za-z0-9_]{0,31}: a popup’s parameter named with a.or starting with_is refused. - Navigation actions’ parameters are applied to the target page (before, they were stored and ignored).
{Name}inside a script is no longer replaced in popups.- A write target with
{Name}on a screen that declares allowed folders is enforced as a pattern no wider than those folders; before,{TagRoot}/Startgated every.../Starttag of the plant.