2 Replies Latest reply on May 2, 2018 4:15 PM by stuart.watson

    Referencing Event Frame Captured Values from within AF


      Is it possible to reference an Event Frame's captured value from within AF?


      I can reference an Event Frame's attributes using the search feature of the AF PI Point attribute. For example, setting up an AF attribute template to


      \\%Server%\%Database%\Eventframes[@Name=%@Similar Name%]|%Attribute%


      will return attribute values named the same in the eventframe, with the name in the Similar Name attribute.

      However, this only works for PI Points, and it does not use the captured value - it uses the PI point value at the current time frame.


      If I use StringBuilder and directly reference an event frame (no attribute value substitution allowed in StringBuilder remember), I get the captured value, not the current value. Similarly using the Formula.

        • Re: Referencing Event Frame Captured Values from within AF
          Rick Davin

          Hi Stuart,


          You are using a relative attribute reference with the PI Point data reference.  What you are observing is intentional - you will not be grabbing the value from the event frame (regardless of whether it was captured).  Instead the %variables% are first resolved to refer to an actual PIPoint, and then the DR will fetch the current value directly from that underlying PIPoint rather than the relative attribute.  That explains the behavior you witness.


          Likewise, String Builder resolves to a string value and may be composed of many attribute values.  In your case, you've defined it to one attribute, namely the event frame attribute.  String Builder does not then redirect to the underlying PIPoint but does asks the attribute for its "current" value.  Given that the value is on an event frame, it's current value is based somewhere between Start and End Time, depending on how you configured it.  You may have to convert the string to a Single or Double.  It doesn't surprise me that String Builder works as it does.  It was nice news to hear it works for Formula.


          The difficulty with grabbing an attributes value from "an" event frame is that it may not be an "an", with the hopeful implication of only being one.  Rather the element may have many, many event frames with the same or different template, and even with similar names.  Which makes it difficult to pick the one from the many.  Note the reverse is easy - an event frame can easily refer to an attribute from its primary referenced element because there truly is only one.


          Also, you use %Server% which refers to the name of the data archive (PIServer).  I am going to guess its the same name as your AF Server (PISystem) since you have many backslashes to reference Database and Element.  This works because your %Server% and %System% currently use the same name, but I would suggest that %System% is the correct variable.  If you ever split apart the data archive and AF Server to where they have different names, your expressions would no longer work.

          1 of 1 people found this helpful