AnsweredAssumed Answered

Correct way to get filtered summaries on discretes

Question asked by PatrickCrummie on Sep 13, 2016
Latest reply on Sep 14, 2016 by PatrickCrummie

I am trying to calculate running times via the AF SDK.

If I run the code:

AFValues recordedValues = pressureStatus.Data.RecordedValues(new AFTimeRange("t-17h-6d", "t+7h-6d"), AFBoundaryType.Inside, null, string.Empty, true);


I get the following results,

AFValue="0" UOM=null Timestamp={2016/09/06 1:15:31 PM} IsGood=true

AFValue="0" UOM=null Timestamp={2016/09/06 9:07:28 PM} IsGood=true

AFValue="1" UOM=null Timestamp={2016/09/06 10:38:04 PM} IsGood=true

AFValue="1" UOM=null Timestamp={2016/09/07 6:29:47 AM} IsGood=true


So I know there is good data with both on and off (actually OPEN and CLOSED) states for the time period in question.

However, When i try to get filterered results by running the following code:

   var summaries = pressureStatus.Data.FilteredSummaries(new AFTimeRange("t-17h-6d", "t+7h-6d"), new AFTimeSpan(TimeSpan.FromMinutes(1)), "'.'=0", AFSummaryTypes.Count, AFCalculationBasis.TimeWeightedDiscrete, AFSampleType.ExpressionRecordedValues,new AFTimeSpan(TimeSpan.FromSeconds(1)), AFTimestampCalculation.EarliestTime);


It returns 1440 AFValues, but the values are all zeroes. Is this merely a syntax problem? I have tried using state e.g. "'.'=OPEN" and "'.'='OPEN'" but these both give errors. Can someone explain to me the correct way to do these summary calculations for discretes?