AnsweredAssumed Answered

PI OLEDB - VBA - with filter expression

Question asked by YoannCollinSubiron on May 22, 2017
Latest reply on May 24, 2017 by John Messinger

Hello everyone,

I am trying to update an old query from an excel spreadsheet with VBA code.

I would like to add a filter on an another tag named STOP_Filtered and where the value is egal to 600.

It's a little bit tricky because as you can see in the example below, the current query shows the results of 4 tags in the same table. The filtered table will have to check for each tag its corresponding STOP_Filtered tag.

I hope someone could help.





SELECT DISTINCT left(NU.tag,9) AS "Turbine Number", Nu.time as "Timestamp", NU.value AS "Status State"  FROM (SELECT tag, time, value, _index  FROM piarchive..picomp2 WHERE tag like '%LDTE%WT%-KPIS_FINALFIRSTFAULTS' AND time >= '01/12/2016' AND time <= '01/01/2017' AND value <>-1 ) NU  OPTION (FORCE ORDER)


Turbine NumberTimestampStatus State
LDTE-WT0101/12/2016  07:04108
LDTE-WT0129/12/2016 05:11108
LDTE-WT0211/12/2016  01:51108
LDTE-WT0306/12/2016  03:18108
LDTE-WT0405/12/2016  21:55