Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI System Management Tools

Tagnames that are valid time expressions

  • Last UpdatedOct 04, 2024
  • 1 minute read

Wherever possible, choose tagnames that cannot possibly be interpreted as time expressions. The tagname t-151d, for example, is also a valid time expression meaning "today minus 151 days."

If you must work with tagnames that are also valid time expressions, use the built-in function TagNum to ensure that the PE Scheduler does not treat the tagname as a time. For example, Abs(TagNum("t-151d")) would return the absolute Snapshot value of point t-151d. Note that TagNum interprets a double-quoted string as the argument.

To the PE Scheduler, an expression within single quotes can correspond either to a time or a tagname. The PE Scheduler treats expressions in single-quotes as tagnames for all the built-in functions that take a point as the first argument (examples include TagVal, TagAvg, and AlmCondition).

In all other cases, the PE Scheduler first attempts to resolve the expression as a time. If the expression is not a valid time, then the PE Scheduler tries to resolve it to a tagname. If the point does not exist, the subsystem returns the error Calc Failed.

For example, TagVal('t-151d') returns the Snapshot value for the point t-151d, if it exists. However, the expression t-151d returns the date corresponding to 151 days before today—because it is a valid time expression.

Related Links
TitleResults for “How to create a CRG?”Also Available in