Create String Builder data references
- Last UpdatedJan 07, 2025
- 4 minute read
- PI System
- PI Server 2018
- PI Server
When a String Builder data reference is used in a template, value substitution takes place at run time.
Create a String Builder data reference when you need to apply string manipulation functions, such as concatenation, to an attribute value and output a reformatted string.
-
Choose one of the following actions:
-
In the Elements browser, select the desired element.
-
In the Event Frames browser, select the desired event frame.
-
In an element template, select the desired element template in the Library browser.
-
-
In the Attribute or Attribute Templates tab, select the attribute.
-
In the attribute configuration panel, choose String Builder from the Data Reference list.
-
Click Settings.
-
In the String Builder Data Reference window, click
.
-
In the highlighted row, press F2 or click
and select from the following options:
Option
Description
Literals
A text string between double quotation marks: "Sample"
Attribute Values
A list of other attributes for the selected element or element template. Note that attributes must appear in single quotes.
Related Attribute Values
A list of the following attribute references:
-
'\\<Server>\<Database>\<Element>|<Attribute>'
-
'\\.\<Database>\<Element>|<Attribute>'
-
'\<Root Element>|<Attribute>'
-
'.\<Child Element>|<Attribute>'
-
'..\|<Primary Parent Attribute>'
-
'..\<Sibling Element>|<Attribute>'
You can also select Search to enter search criteria in the Attribute Search window.
Substitution Parameters
A list of 20 commonly used substitution parameters. For more information, see List of PI AF substitution parameters.
Functions
A list of the following functions:
-
Left(string, length)
-
Right(string, length)
-
Mid(string, length)
-
Mid(string, start, length)
-
UCase(string)
-
LCase(string)
-
Trim(string)
-
RTrim(string)
-
LTrim(string)
-
Replace(string, string, string)
-
Format(Real, "%3.3f")
-
Format(Real "%3.3f", "en-US")
-
Format(DateTime, "yyyy-MM-dd HH:mm:ss")
-
Format(DateTime, "yyyy-MM-dd HH:mm:ss", "en-US")
-
Format(Array, Separator)
-
NewLine()
-
-
Build your expression further. You can either type a semicolon (;) and continue in the same row, or click
to continue on another row. You can use the following icons to manipulate the expression:
To ...
Do this ...
Append a new string
Click
.
Remove a string
Select a row and click
.
Remove all strings
Click
.
Move a string up a row
Select a row below the top row and click
.
Move a string down a row
Select a row above the bottom row and click
.
As you build the string expression, you can preview the result of the expression in the Value field.
-
When the string expression is complete, click OK.
Examples
-
You can enter the following substitution parameters in a single row to concatenate a pathname string. For example:
"%Database%";"\";"%Element%";"|";"%Attribute%";
-
This data reference would produce output similar to: .
-
You can build an expression in separate rows to show the duration of an event. For example:
-
Click
, press F2 and select Substitution Parameters > "%StartTime%".
-
Click
and type the characters: " to "
-
Click
, press F2 and select Substitution Parameters > "%EndTime%".
-
The Value field shows a date and time interval:
-
For more examples, see Function implementation in String Builder.