Expressions

The JavaScript-like expression language used in virtual tags and the page editor, and the functions each one exposes.

Several places in THMI let you write a short expression — a JavaScript-like snippet — to compute a value or drive behavior. They share a language but run in different places and expose different functions, so it matters which one you’re writing.

The two contexts

  • Virtual tag expressions — run server-side (on the Edge) to compute a virtual tag’s value. A virtual tag has a read script and an optional write script. These can read and write tags, read history and alarms, and — with the right integration — pull in outside data.
  • Page editor expressions — run client-side (in the browser) on a page, to control how an element looks and behaves and to wire up operator interaction. These can read and format tag values, navigate, and write values from the page.

Because they run in different places, the function sets differ. A few names overlap — value, getCurrentTime, getTimeBefore — but each context’s reference below lists exactly what’s available there.

References