AnsweredAssumed Answered

How do I get a list of notification instances quickly?

Question asked by SvenBatalla on Nov 10, 2016
Latest reply on Jan 19, 2017 by SvenBatalla

I have recently been tasked with attaining a list of PI-Notification instances for the purposes of visualisation for our user base.  This visual needs to include a certain amount of information, but I am having trouble just getting the list at all.  I require help from the community to understand how to quickly retrieve the information I require.


Note:  I am using PI-AF and PI-Notifications 2016.


For clarity, I am looking for instances and not templates.  It is very simple and very quick to get the list of PI-Notification templates, but I am looking for the instances.  So what is an "instance"?  Well, imagine I have an element template called "Pump" and then I associate a PI-Notification template to it.  An "instance" of a notification is each "real" notification that is created as a result of the implementation of said "Pump" element template.  So if I have 1 PI-Notification template on the "Pump" element template and 1,000 elements using that element template, then I have 1,000 notification instances.


At this point, I believe I have 2 ways to gather the list of notification instances:

  1. The first option is to get the list of all event frames, the elements that they are associated with, and then any PI-Notifications associated to those elements.  The main problem with this (unless I am mistaken) is that this only works if an event frame has been created for the notification.  So if a notification instance has never become active, there would not be an event frame, and thus I would not get back a notification instance.  Beyond that, you can imagine the performance of this is very bad.
  2. The second option is to get the list of all elements and then any PI-Notifications associated to those elements.  This takes event frames out of the question and boosts performance (although not by much and still not acceptably so).  However, it also means that I can't easily know which notification instances are active.  Remember I am trying to collect information about each notification instance too.


My understanding is that OSIsoft uses their own SDKs in their services and clients.  That means that the PI-Notifications service must have to collect a lot of this information already in order to do its job.  So my conclusion is that I must be doing something wrong or backwards.  Can anyone in the community provide me some sample code for retrieving a list of PI-Notification instances in a good-performing manner?