I'm struggling with the MS SQL v2 Sensor. First what I would like to check. We've a database "Test" and would like to check when last time was something written into table "tabletest". For this we tried it with the following queries which both are working properly.
a) Output 1 if the last entry was within the last 10 minutes or 0 if it's older
if (select top 1 datediff(minute,time,current_timestamp) as last_entry from tabletest ORDER BY time DESC) <10 print '1' else print '0';
b) Output within a table with the difference value from actual time to the last entry time
select top 1 datediff(minute,time,current_timestamp) as last_entry from dbo.RexExtrusionPIValues ORDER BY time DESC
The question is now how do I need to configure the sensor to get the following result? a) Ok = 1, Error = 0
b) Ok if the value is >= 10 or error if the value is bigger than 10
I'm able to run the sensor with the query but not to configure how it handles my output. For case b) I tried to generate a value lookup file but struggling with the bigger than check.