ChewCheeLim

Comparing summary value (Average) against PI OLEDB Commander

Discussion created by ChewCheeLim on Apr 3, 2013
Latest reply on Apr 5, 2013 by ChewCheeLim

Hi, I am trying to compare my Average value with AF SDK 2.5 call like so:-

 

afValue = aPiValues[AFSummaryTypes.Average]; -- note: local date time passed in to get daily value for AFTimeRange

 

with SQL Comander value.

 

Somehow, I am not able to match the value 100%. Do I use the right method of cross check my AF SDK 2.5 logic? to make sure what I see is what I get in C#.

 

 

 

PI OLEDB SQL commander query:

 

select temp_date = CONCAT(cast(YEAR(time) as string) ,'-', format( MONTH(time)  ,'00'), '-', format(DAY(time),'00') ) , AVG(valueDbl) as value_average -- NOT GOOD. nothing tied up properly. , MIN(ValueDbl) as value_minimum -- good. need to add 1 hr to the recdate. but not good on gap data. where did the value get pull from? , MAX(ValueDbl) as value_maximum --- good. but not good on gap data. where did the value get pull from? from rbc.data.archive where ElementAttributeid = 'ffffb4e1-ffff-ffff-64df-fdffffffffff'   AND time between DATE('2013-03-31 00:00:00.000') AND   DATE('2013-04-01 00:00:00.000')  group by CONCAT(cast(YEAR(time) as string) ,'-', format( MONTH(time)  ,'00'), '-', format(DAY(time),'00') )    

Outcomes