AnsweredAssumed Answered

Error when using .Calculate

Question asked by IJourneaux on Sep 16, 2019
Latest reply on Sep 16, 2019 by gregor

I make a bunch of calls to PI using

 

Set ipiCalc = server
expr2 = "if EventCount('" & tagnm & "', '*', '*') = 1 then '" & tagnm & "' else PrevVal('" & tagnm & "','*')"
expr1 = "if(" & FilterString & ") then " & expr2 & " else NoOutput()"
Set vals1 = ipiCalc.Calculate(StartDate, EndDate, expr1, PISDK.SampleTypeConstants.stInterval, Period)

 

For some reason, I sometimes get  an error

"Failed to retrieve events from server [-11091] Event collected exceeded the maximum allowed"

I shouldn't be running into a number of events issue.

 

If I exit and restart Excel, the query will invariably work. I am guessing a memory leak of some kind. Is there a workaround that doesn't involve restarting Excel?

Outcomes