From DataLink to OleDB

Discussion created by JanvanderVen on Feb 25, 2009
Latest reply on Feb 26, 2009 by mhamel

I have a customer request to migrate a PIAdvCalcFilVal into OleDB. The parameters for the function are:


tag, 'y+6h', 't+6h', 'tag'>50, "count", "time-weighted","pt. compressed","10m",0,1,0, server


The customer then divides the answer by 3600. That is to return hours, I guess.


It is the "count" part that causes me the trouble. I interpret this statement as: get all archived points in the time range, check whether the value is above 50 and return the 'count' over some period.


With the following query I am off by 450 seconds:


SELECT SUM(c.value) FROM piarchive..picount c
INNER JOIN piarchive..piinterp p ON p.tag=c.tag AND c.time=p.time
c.tag = 'SINUSOID' AND c.time BETWEEN 'y+6h'
AND 't+6h' AND p.time BETWEEN 'y+6h' AND 't+6h'
AND p.timestep = '10m'
AND c.timestep='10m'
AND c.calcbasis = 'TimeWeighted'
AND p.value>50


And this is interpolated not compressed.


Please advise.


Kind regards,


Jan van der Ven