4 Replies Latest reply on Mar 9, 2018 1:50 PM by VCampus-METCO

    How do I add non-PI Point attribute references to Event Frames


      All examples in the documentation and videos show adding attributes of DR PI Point to event frame templates.

      How can you add other attributes that might not be of this type but which are time-dependant?

      I can understand how static information such as a description could be inferred back to the reference element, but what about for example an attribute that is a linked Table Lookup DR, where the value may change over time. There seems to be no way to reference such an attribute in the Event Frame. Do you also have to go back to the reference element and re-query based on the event frame time? What  if the source data has been removed from the source table in which case such a solution will not work.

        • Re: How do I add non-PI Point attribute references to Event Frames

          Hi Simon,


          I would suggest using the same method Gabriel Michaud-Verreault suggested in this post; use a formula data reference. Thus the configuration would like:





          1 of 1 people found this helpful
          • Re: How do I add non-PI Point attribute references to Event Frames
            Rick Davin

            Hi Simon,


            The part that is problematic is the time-dependent part and how the time context is treated on an event frame.  How this is done on an event frame depends purely upon the data reference.  The PI Point DR allows you to specify whether you want the StartTime or EndTime of the event frame.  All other OSIsoft data references - most notably Table Lookup, Formula, StringBuilder - do not give you this option.  Those other DR's are limited to only using the EndTime.


            In the AF SDK Online Learning course, which was updated last year, there was a more process oriented custom data reference example.  It had code to treat the time context differently for event frames versus elements with this custom method:


            private AFTime ToAFTime(object timeContext)
                if (timeContext is AFTime)
                    return (AFTime)timeContext;
                else if (timeContext is AFTimeRange)
                    var baseElement = Attribute.Element;
                    var useStartTime = (baseElement is AFEventFrame);
                    var timeRange = (AFTimeRange)timeContext;
                    return useStartTime ? timeRange.StartTime : timeRange.EndTime;
                return AFTime.NowInWholeSeconds;


            But that is entirely up to the developer to implement for their custom DR.  Such logic would most likely not be put into Table Lookup, Formula, or StringBuilder as that would radically affect existing code.  On the other hand, it would be nice if a TimeMethod option could be added to them.


            Which means what for you?  TLDR, Formula, and StringBuilder may not be sufficient since they are restricted to EndTime.  And I find that disappointing because that gives me the value when the event frame closes, which I find entirely boring.  What I'm more interested in is the value for when the event frame starts.


            The only possible workaround is if your TLDR depends upon static attributes and PI points from the primary referenced element.  You can reference static attributes with StringBuilder, and use a relative PI point reference and a TimeMethod of StartTime.  If that's all the info you need, then you may use TLDR or Formula's accordingly.