AnsweredAssumed Answered

SQL event if value changed

Question asked by igreguri Champion on Jan 17, 2017
Latest reply on Jan 24, 2017 by gregor


I need to monitor control loops if value changed (in shift, 12 hours).

When value was changed from AUTO or CAS then show time, tagname, old value and new value.

Time must be from 7 AM to 7 PM and after that from 7 PM to 7 AM.

Is possible to write this changes to one PI point (PS: I have older AF v2.5.0.5039 without Analyses)?


My query:

SELECT format (time,'dd.MM.yyyy  hh:mm') as time, s.tag, value as now, prevval(s.tag, time) beforeval, prevevent(s.tag, time) beforetime

FROM [piarchive].[pisnapshot] s

inner JOIN [pipoint].[classic] d ON s.tag = d.tag

WHERE s.tag LIKE 'RADU3LC%.MODE' or s.tag LIKE 'RADU3PC%.MODE' or s.tag LIKE 'RADU3TC%.MODE' or s.tag LIKE 'RADU3FC%.MODE' AND value <> prevval(s.tag, time)