1 Reply Latest reply on Nov 2, 2017 12:46 PM by rschmitz

    PI Vision - How to get Asset Context and Event Frames in Custom Symbol?

    MikeRay

      Hi There,

       

      I am developing a custom symbol for PI Vision that is based around event frames and assets. So far I have been able to develop a few symbols that are simply to do with data from the attributes on an element, but this one is now requiring me to be able to access the asset context, its template and the event frames that are associated with it. I can use the standard event frame tool pane to locate the event frames in question however they don't seem to be made available in the onDataUpdate event - this seems to cover only attributes.

       

      So my questions are:

       

      Is there an event to implement for getting the event frames in the event frame tool pane for the display hosting my custom symbol (so I don't have to implement my own event frame search)?

       

      Also is there a simple way to determine the current asset context (and its template if present) of the display?

       

      Can I get the display start and end times programmatically?

       

      Of course if these things don't exist I will default to parsing the asset from the full path of an attribute passing data to the symbol and then calling the PI Web API to get the template, and from there search for event frames. Does this sound like a good approach?

       

      Thanks,

       

      Mike.

        • Re: PI Vision - How to get Asset Context and Event Frames in Custom Symbol?
          rschmitz

          Hey Mike,

          You can get the start and end times of the display by referencing using the timeProvider in your initialization function, however to get them to update with your display (rather than just on page load) you'll also need angular's $interval module functionality as well. For example:

           

          function init(timeProvider, $rootScope, $interval) {

             $interval(function () {

                var startTime = timeProvider.getDisplayStartTime();

                var endTime = timeProvider.getDisplayEndTime();

             }, 1000)

          }

           

          If you have issues with that, you can also get them via their ID's on the webpage:

          var startTime = document.getElementById('start-time-input').value;

          var endTime = document.getElementById('end-time-input').value;

           

           

          I'm not aware of any event for having the event frames auto-populate for a given asset context and timeframe. Although your workaround of creating a PI Web API call to gather than information is exactly what I would recommend in lieu.

           

          --Rob

          3 of 3 people found this helpful