AnsweredAssumed Answered

Fetch archived values of tags over a time range and perform average

Question asked by Rituparna on Jul 10, 2019
Latest reply on Jul 11, 2019 by Rituparna

Hi, 

I want to fetch archived values of tags based of frequency over a time range and perform average on those values. I tried in two ways as below. But I am getting error saying "Object reference not set to an instance of an object"

 

1)AFValues AvgValue = item.Attributes[item.Name.ToString()].Data.RecordedValues(timeRange, 0, null, null, false, 10000);
2) IDictionary<AFSummaryTypes, AFValue> AvgValue = item.Attributes[item.Name.ToString()].Data.Summary(timeRange, OSIsoft.AF.Data.AFSummaryTypes.Average, OSIsoft.AF.Data.AFCalculationBasis.EventWeighted, OSIsoft.AF.Data.AFTimestampCalculation.Auto);

 

 

Can you help to do the same?

 

Thanks,

Outcomes