10 Replies Latest reply on Aug 18, 2016 3:43 PM by vwitzel

    Notifications Dilemmas

    kpotter

      I’m trying to use PI-Notifications to send a daily report of data from an AF table.  The first column is DateTime, and the others are numbers. 

       

      Dilemma #1:  Notifications do not allow adding content from AF tables (unless I’m missing something). 

       

      So, I create several Table Lookups so that I can add the Attribute Values. 

       

      Dilemma #2: Attributes which are not PI Point (ie. Table Lookup) always report the value “{Error inserting result}” 

       

      So, if I can somehow write everything to PI tags, then I can get values in the body of the notification. 

       

      Dilemma #3: DateTime values offer no formatting options, so all are listed in the form “5/6/2013 2:24:14 PM Central Standard Time (GMT-06:00:00) ”, which is far too large when I need to list several.

       

      Then, I succeed in developing a solution which writes my reports to CSV files, so I may simply send them as an attachment. 

       

      Dilemma #4:  Attachments are embedded into the database at the time the notification is created.  So the notification sends the same old file every time. 

       

      Tech support provides a solution to continually re-embed the latest file, but: 

       

      Dilemma #5: The solution fails to install on 64-bit machines. 

       

      Dilemma #6: On the 32-bit machine, the solution replaces the commas in the CSV to tabs, ruining the “Comma Separation” aspect of the CSV file. 

       

      Any advice on finding the best path to success is appreciated.

        • Re: Notifications Dilemmas
          Mike Zboray

          Hey Ken,

           

          There is no way to create notification content from an AFTable directly, using an attribute is the preferred way to do this. It would be helpful if you described your configuration for the TableLookup DR since it seems to work for me.

           

          It is possible to format timestamps in notifications. When in the Notifications plugin in PSE, go to Tools > Notifications Settings. On the Global Configuration tab, there is an entry "Timestamp Display Format", where you can edit the format. This is used to format times in all notifications. Unfortunately, there is nothing more granular.

           

          From PISDK help, PITimeFormat:

          CharactersMeaning
          yy, yyyy Year, 2 or 4 digits
          M, MM Month, short/long number
          MMM, MMMM Month, short/long name
          d, dd Day, short/long number
          ddd, dddd Weekday, short/long name
          h, hh Hour, short/long number
          m, mm Minute, short/long number
          s, ss Seconds, short/long number
          0 - 000000 Fraction of second, show trailing zeros
          # - ###### Fraction of second, no trailing zeros
          z, zz Time zone, short/long name
          i[name] Interval ordinal, short form
          ii[name] Interval ordinal, long form
          iii[name] Interval member name, short
          iiii[name] Interval member name, long
          . Local decimal separator.
          : Local time separator.
          - Local date separator.
          AP Local AM/PM symbol. Specifying AP also changes to 12 hour time display format. The default time format without AP is 24 hour time display.
          \ The character following the backslash is literal.
          Any other character. Itself. For instance, a "T" inserted between date and time.

          Mike

          1 of 1 people found this helpful
            • Re: Notifications Dilemmas

              Yes you should be able to insert any attributes into your notification and not just pi point data references.  For dilemma 2, could you try a quick workaround by creating a formula that simply takes the value of your table lookup as its input and outputs that same value.  Then point your notification to display that formula.  If this doesn't work we may have a more endemic issue with how your notifications are functioning.

                • Re: Notifications Dilemmas
                  kpotter

                  Thank you for the input.  The time formatting is particularly helpful.  Now, I just did exactly what Dmitri has recommended - a very simple table lookup AND a formula set equal to it.  I have both in my notification, and both are "{Error inserting result}”  In fact, I've done quite a bit on notifications work on several environments, and this seems to be a common issue with attributes other than PI Point attributes.

                    • Re: Notifications Dilemmas

                      Hi Ken,

                       

                      I looked into your issue.  Could you check if you can see these attribute in an html preview of your message in PI System Explorer (in PI System Explorer > Notifications > Select a Notification > Message > HTML Preview).  If you can, please try restarting your Notifications Scheduler Service and sending out the message again to see if the error persists afterwards.

                      1 of 1 people found this helpful
                        • Re: Notifications Dilemmas
                          kpotter

                          That fixed it, Thank you!!!

                            • Re: Notifications Dilemmas
                              kpotter

                              Is there are way to format numbers (ie. 1 decimal)?  Also, is there a way to send plain text only (no HTML)?

                                • Re: Notifications Dilemmas
                                  Mike Zboray

                                  Hey Ken,

                                   

                                  Formatting for numbers can only be set globally for all notifications. This settings is not documented, but is described in this post.

                                   

                                  To only send plain text, there is setting on the endpoint "Use HTML for Format" that must be turned off. This setting is on each endpoint/subscription because, typically, support for html is determined by the recipient of the message.  You can set this for a specific subscription on a notification by right clicking the subscriber and selecting Options. In this window, uncheck "Use HTML for Format". You can also configure this globally for the endpoint by changing it in the Contacts plugin.

                                   

                                  Mike

                                   

                                   

                                  1 of 1 people found this helpful
                                    • Re: Notifications Dilemmas
                                      kpotter

                                      Thank you... I'm making progress.  I'm developing a report which has 600 values (from a table: 6 columns x 100 rows).  I have one element with the 600 table lookups.  Is there a faster way to get these into the notification other than one-by-one?  I thought I could do something clever with the exported xml, but each attribute seems to need a cryptic name like: <Name>533971d3-db2b-4d32-ad94-1307612a381f</Name>

                                        • Re: Notifications Dilemmas
                                          Mike Zboray

                                          There's not a faster way without writing code using the AFSDK and ANSDK's. There are two parts you would want to automate. One is adding the attributes to the notification's content. The other is actually inserting the attribute content items into the email. Are you using delivery formats or old-style notification content on each subscriber?

                          • Re: Notifications Dilemmas
                            vwitzel

                            Kenneth,

                            In your original post, under Dilemma 4, you described that, "Attachments are embedded into the database at the time the notification is created.  So the notification sends the same old file every time", but that, "Tech support provides a solution to continually re-embed the latest file." Could you share what solution it was that tech support provided you with?

                            Thanks