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

Asset Framework and PI System Explorer (PI Server 2018)

Create String Builder data references

  • Last UpdatedJan 07, 2025
  • 4 minute read

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.

  1. 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.

  2. In the Attribute or Attribute Templates tab, select the attribute.

  3. In the attribute configuration panel, choose String Builder from the Data Reference list.

  4. Click Settings.

  5. In the String Builder Data Reference window, click .

  6. 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()

  7. 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.

  8. 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: DB26\WX12000|pressure.

  • You can build an expression in separate rows to show the duration of an event. For example:

    1. Click , press F2 and select Substitution Parameters > "%StartTime%".

    2. Click and type the characters: " to "

    3. Click , press F2 and select Substitution Parameters > "%EndTime%".

    4. The Value field shows a date and time interval:

      A screenshot example of the String Builder Data Reference dialog showing how to build an expression that displays the duration of an event using the Start and End Time substitution parameters.

For more examples, see Function implementation in String Builder.

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