AnsweredAssumed Answered

Trying to use PIValues.Summary method to return average over time

Question asked by Koerkel on Mar 7, 2018
Latest reply on Mar 7, 2018 by rdavin

Having some trouble returning the average.  Here is my VB code.



Dim srvr As PISDK.Server

Dim tagg As PIPoint

Dim tagvals As PIValues

Dim tagvalue As PIValue


Set srvr = PISDK.Servers(server1)

Set tagg = srvr.PIPoints(tagname)

Set tagvals = tagg.Data.RecordedValues(starttime, endtime, btInside)

Set tagvalue = tagvals.Summary(starttime, endtime, astMaximum, cbTimeWeighted, Null)


tagvalue is always "nothing" even though tagvals has 639 values.


I have also tried

Set tagvalue = tagg.Data.Summary(starttime, endtime, astAverage, cbTimeWeighted, Null)

with same result.


Any suggestion how to return the average value from my PI tag us PI SDK?