Skip to Main Content
AVEVA Product Feedback


175 VOTE
Status No Status
Created by Guest
Created on Aug 19, 2022

Add more advanced string handling functions to the String Builder data reference

I would like to use some more advanced string functions such as Split, Len (string length), and even regex filtering to allow more fine grained control of how some input strings (such as attribute values or substitution parameters) are manipulated to create a new string output.
  • Attach files
  • Luan Sandes
    Reply
    |
    Jan 5, 2023

    As a PI developer, I would like to parse an alarm message within an Event Frame attribute using String Builder. The alarm message is in the format: "a | b | c | d e x", where x is the term of interest. This would only be possible with functions like InStr and Len.

  • Guest
    Reply
    |
    Aug 19, 2022
    John has proposed some functionality that would solve some very real world issues for us.  If we can chop up some strings, we will be able to improve the quality of integration we have to our systems, for Well and Compressor Work Management System. Right now, we have to maintain a set of tables for Table Lookup to be able to provide the strings that are already encoded within a string attribute we already have.
  • Guest
    Reply
    |
    Aug 19, 2022
    Simply adding the string functions available in the analysis menu would be a great improve for the attribute string builder. It would also be nice to be able to use substitution parameters in any argument for string builder functions and not just the first argument. For example, using the replace function in string builder I can use %Element% for the first argument but not the second or third.
  • Guest
    Reply
    |
    Aug 19, 2022
    We are evaluating what features we should prioritize for StringBuilder. We want to make sure that we are addressing use cases that are current pain points. Would anyone interested in this feature be willing to share (here or over email) examples? Specifically we are looking for: * Input sources and example values (e.g. %Element% is "Well 123" or 'attribute' is "Active") * The logic that needs to be applied to those inputs and the expected output (based on the example inputs)
  • Guest
    Reply
    |
    Aug 19, 2022
    In response to David Moler, "We are evaluating what features we shoul..." Hi David,   Some of the additional functionality I would like to see includes the following standard .Net String methods: Clone()Insert()LengthPadLeft() & PadRight()Remove()Split()  I'd also like to see the following string methods from Analyses as additional functionality in the StringBuilder: Char()Len() - pretty much same as above Length() function  I also agree with Kevin Fisk that being able to use substitution parameters in all the arguments of the Replace() function would be useful.   Not covered in the above two lists is an IsNumeric() method. More on this later.   Also, it would be great if some regex functionality could be included, where I can extract a specific matching substring from a larger string based on a regular expression.   Lastly, a simple If..Then..Else function to be able able to make a decision on how to extract part of a string would be really useful. For example, I might like to extract a substring at the beginning or end of another string, but only the numeric component (or maybe only the non-numeric component). An example of the envisioned usage would be:   If IsNumeric(Right(%Element%, 3)) Then Right(%Element%, 3) Else Right(%Element%, 2)   This is particularly useful when dealing with assets that are alphanumerically named with the number at the end of the string (such as one of our customer's gas wells) and we want to extract either the numeric or non-numeric component from a well that may have either two or three numbers at the end (ie, Well99 or Well208).   Cheers, John
  • Guest
    Reply
    |
    Aug 19, 2022
    In response to John Messinger, "Hi David,   Some of the additional funct..." John, What are you trying to do?  Are you parsing alarms and events? -- Steve Kwan
  • Guest
    Reply
    |
    Aug 19, 2022
    In response to Stephen Kwan, "John, What are you trying to do?  Are yo..." Hi Steve,   That wasn't my original use case, but these would probably be easier to parse with some of these kind of functions. I'm more looking at parsing various string elements for PI tag name resolution - some of my customers (and one in particular where I have a couple of current projects) use some very nicely consistent naming conventions, and being able to dynamically resolve tag names from asset string data would be easier with some of these functions.   Cheers, John
  • Guest
    Reply
    |
    Aug 19, 2022
    An additional capability that would be good is the ability to parse a string by delimiters. This would be helpful when tracking alarms and events from the Interface for OPC AE. OPC AE messages are sent as a pipe (|) delimited string and stored as string PI tags. For alarm and event tracking with event frames, it is useful to split the pipe delimited string and store each alarm attribute as an AF child attribute. Currently this must be done in asset analytics using the InStr function, which is not available in String Builder. I've attached a relevant tech support case to this enhancement request.
  • Guest
    Reply
    |
    Aug 19, 2022
    Just to add to this, another use case is to get the root element of the current element path (as opposed to the parent element). As an example, I can create an attribute "SitePath" with %ElementPath% and it will get me a value as something like below: Element1\Element1.1\Elmenet1.1.1\Element1.1.1.1\Element1.1.1.1 To get the 2nd element from the root (i.e. "Element1.1"), I would have to do this in Analytics with the combination of following functions: - InStr() - Left() - Mid() Which is not possible with String Builder. (Unless there is already a substitution parameter to get me the element FROM the top down, instead from the bottom up)
  • Guest
    Reply
    |
    Aug 19, 2022
    I would love to see a basic if/then/else function added to String Builder. In some cases, I can work around it using Replace or other functions, but I have had to abandon dozens of attempts where I want a string attribute to depend on some other attribute's value, and found it impossible. An IF function would have been perfect each time.
  • Guest
    Reply
    |
    Aug 19, 2022
    See Support case 960088; trying to create a reference to a child attribute in another branch in an AF template. That attribute value is static content.
  • Guest
    Reply
    |
    Aug 19, 2022
    Additionally, in case 00563064 we are attempting to format integers with comma thousand separators (123456789 --> 123,456,789). This is not possible with the current string builder function support (2018 SP1). Introducing the Len() PE function among other functions that have been suggested so far would enable users to format strings of variable length.
  • Guest
    Reply
    |
    Aug 19, 2022
    We would like to see a format string that formats a number to a string and inserts commas in the appropriate positions. Example number 9999999 formats to 9,999,999 along with decimals, currency, etc. Our primary use is when data from an event frame is included in a notification. String builder could also be used to read the data from the PI Archive and format it into the Event Frame attributes as a string.
  • Guest
    Reply
    |
    Aug 19, 2022
    Using the string builder interface is confusing. The best method that I've found is to click the right arrow ">", look for the function, reference, etc. that I need and then type it in on another line. I've worked with at least two support engineers that have had similar problems when helping me via a Bomgar session.
  • Guest
    Reply
    |
    Aug 19, 2022
    I may have discovered a side effect using the analysis to populate an event frame with the formatted value. Each time the EF creates a child, it appears that PI re-executes the analysis. If both the raw numeric value and the formatted string are stored in the EF, they may be different. I have an analysis that executes every 15 minutes. It stores the raw numeric data and the formatted string in separate AF attributes. I have a second event triggered analysis that creates an event frame if the raw numeric value exceeds it's Hi Limit. The EF contains the raw numeric value as it was when the original EF was created but the formatted string contains the current value. The ability to format the string in String Builder would eliminate the need for two attributes and this potential discrepancy.
  • Guest
    Reply
    |
    Aug 19, 2022
    A String Length and Basic Delimiter function needs to be part of the core string builder functionality. This would solve a lot of issues with handling tabular alarm data.
  • Guest
    Reply
    |
    Aug 19, 2022
    In response to Chris Beaupre, "A String Length and Basic Delimiter func..." Can you help me understand what you're trying to do with tabular alarm data?  As you know, an AF data reference such as the string builder is only executed on demand by the client.  In order to have a fruitful discussion, it would be great if we can get some details on your use cases. -- Steve Kwan
  • Guest
    Reply
    |
    Aug 19, 2022
    Splitting on a separator (.,-) could help with separating a string. Split('MyText.YourText', '.')[0] => 'MyText'. Will this be possible?
  • Guest
    Reply
    |
    Aug 19, 2022
    AF 2018 SP2a has a new feature for splitting strings. Please see release note: 144299 - Split function was added to Expression and Event Frame Generation analyses to split a string into a string array.
  • Guest
    Reply
    |
    Aug 19, 2022
    In response to Stephen Kwan, "AF 2018 SP2a has a new feature for split..." Hi Steve, That's a great step for Analytics, and I'll have to have a look at how it works. Would still like to see this in the StringBuilder DR as well, given the way this DR is often used for dynamically generating a tag name to be used in the PI Point DR.
  • Load older comments
  • +75