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

PI Connector for UFL

Learn about data manipulation logic

  • Last UpdatedJan 28, 2025
  • 1 minute read

Data manipulation logic examples

Simple expressions with arithmetic operators.

[FIELD]
FIELD(1).Name = "StrVal"
FIELD(1).Type = "String"
FIELD(2).Name = "NumVal"
FIELD(2).Type = "Number"

Data file content: 001, Value: 1.23

Create a tag name using the '&' operator, and scale the value by a factor of 100.

[MSG(1)]
StrVal = C1 – (",")
StrVal = "TAG_" + StrVal

Extract the value and scale it:

NumVal = ["*: (*)"]
NumVal = 100 * NumVal

Mathematical function

[FIELD]
FIELD(1).Name = "NumVal1"
FIELD(1).Type = "Number"
FIELD(2).Name = "NumVal2"
FIELD(2).Type = "Number"

Data file content: Value1: 1.23; Value2: 2.61

[MSG(1)]
NumVal1 = ["*:(*);*"]
NumVal2 = ["*:*:(*)"]

Apply ROUND():

NumVal1 = ROUND(NumVal1)
NumVal2 = ROUND(NumVal2)

String functions

[FIELD]
FIELD(1).Name = "StrVal"
FIELD(1).Type = "String"

Replace a known error message:

[MSG(1)]
StrVal = C1 – (";")
StrVal = REPLACE(StrVal, "Invalid string part", "OK")

Sub-milliseconds

[FIELD]
FIELD(1).Name = "TimeStampVal"
FIELD(1).Type = "DateTime"
FIELD(1).Format = "dd-MMM-yyyy hh:mm:ss.nnn"
FIELD(2).Name = "NumVal"
FIELD(2).Type = "Number"

Data file content: 01-Jul-2015 08:00:00.1234; 123

PI supports time precision up to 15 microseconds.

[MSG(1)]
TimeStampVal = ["(*);*"]

Extract the number after the semicolon:

NumVal = ["*;(*)"]

DateTime math

Use "-" or "+" to conditionally adjust for daylight saving time.

FIELD(1).Name = "TimeStamp"
FIELD(1).Type = "DateTime"
FIELD(1).Format = "dd-MMM-yyyy hh:mm:ss"

FIELD(2).Name = "TimeOffset"
FIELD(2).Type = "Time"
FIELD(2).Format = "hh:mm:ss"

TimeOffset = "01:00:00"
IF(TimeStamp>="25-Mar-2014 03:00:00" AND TimeStamp<"28-Oct-2014 03:00:00") THEN
TimeStamp = TimeStamp - TimeOffset
ENDIF

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