2 Replies Latest reply on Feb 20, 2012 4:12 AM by Bineesh

    PI Notification TimeRule - periodic

    Bineesh

      Hi

       

      Could you please share code snippet for developing timerule for notification as periodic.

       

      What I would need to achieve here is,

       

                          1. Periodic timerule -  Begin At

       

                           2. uncheck the option to "Notify only on change in status"

       

      I have referred the follwoing link

       

       http://vcampus.osisoft.com/discussion_hall/development_with_osisoft_sdks/f/28/p/254/14669.aspx

       

      but appreciate if you could provide some sample code.

       

      thanks,

       

      Bineesh 

        • Re: PI Notification TimeRule - periodic
          hanyong

          Hi Bineesh,

           

          From what I know, you can find time rule setting if you look at the notification's time rule's (AFNotification.Analysis.TimeRule) config string.

           

          For example, If I configure a notification what triggers hourly, with an offset of 7 minutes, if we look at the AFNotification.Analysis.TimeRule

          AFNamedCollectionList<AFNotification> nlist = AFNotification.FindNotifications(_afdb, "", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100);
          AFNotification a = nlist[0]; // get the 1st notification in the server
          AFAnalysis analysis = a.Analysis;
          AFTimeRule tr = analysis.TimeRule; // get the time rule setting
          Console.WriteLine(tr.ConfigString); // this is a console application

          You can define your frequency and offset (Begin At) parameters appropriately by editing the config string and checking in the notitication.

           

          There isn't a lot of documentation on how the config string should be but one way that I would go about this is to configure a notification in PI System Explorer and look at the time rule config string programmatically.

           

          As for the option to "Notify only on change in status". This is actually not part of the time rule setting, instead it is a notification setting. This is represented by the AFNotification.ChangeOnly property. Same as the Resend Interval and Non-Repeitition Interval option in the same section.

           

          Hope this helps