This content has been marked as final. Show 1 reply
1 of 1 people found this helpful
You can use AFCalculation.PercentTrue Method to do that. Here is some sample code. This will find in a 10 min interval the duration that boolean expression is true.
var timerange = new AFTimeRange("*-10m", "*"); var vals = AFCalculation.PercentTrue(db, "yourbooleanexpression", timerange, new AFTimeSpan(timerange.Span), new AFTimeSpan(timerange.Span), AFTimestampCalculation.MostRecentTime,out var pctgood); Console.WriteLine(Convert.ToSingle(vals.Value)/100*timerange.Span.Minutes);