PeteHerz

Creating a Trend from a Data Set/SQL Database Information

Discussion created by PeteHerz on Nov 25, 2014
Latest reply on Dec 1, 2014 by gachen

Good morning PI users!

 

I've recently been trying to include more and more information from our SQL database into our Process displays (i.e. fault summation and current active step).  However, I'm at an impasse trying to include SQL information into a trend along with other tags.  For instance, using the data below as an example I have a value that is tied to an ODBC Data Set which performs a query to pull the Count(Fault 2) messages since midnight.  So it correctly shows 3 as the value of faults. 

 

Message        Time

Fault 1          11:20 AM

Fault 2          10:30 AM

Fault 9          10:02 AM

Fault 2           9:05 AM

Fault 2           8:30 AM

Fault 5           7:45 AM

 

However, in order to see the relationship between a specific fault message and the temperature set as a PI tag, I would like to have them both on the same trend to be able to see how they progressed throughout the night.  When I graph the data set, it stays at a constant 3 [instead of 0 from midnight to 8:30AM, 1 from 8:30AM to 9:05AM, and so on].  Is there an efficient way to do this through VBA?  I've tried Value.GetValue and putting it into a ListBox but it only compiles information as I have the display open.

 

Any advice or directional guidance would be greatly appreciated.

 

Thanks!

Outcomes