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?