AnsweredAssumed Answered

AFEventFrameSearch returns outdated (cached?) data

Question asked by KarstenS on Dec 11, 2019
Latest reply on Dec 11, 2019 by KarstenS

We have to cyclically and from multiple callers query data from PI-AF.

 

We create a new PISystem for every call but use the implicit connection (from here: Connecting to a PI AF Server) with no explicit .Connect() or credentials like this:

 

var piSystems = new PISystems();
var piSystem = piSystems[_assetServer];

var afDatabase = piSystem.Databases[database];

 

Then start a search with

 

var search = new AFEventFrameSearch(afDatabase, "My Search", tokenlist);

 

When the program runs for a while and new AFEventFrames (visible in PI Process Explorer) are written to PIAF, the query will still return old data without the new AFEventFrame.


A restart of the program will immediately return the updated AFEventFrames.

 

How can we solve this?

 

Is piSystem.Refresh() the right call? The documentation isn't clear on that: https://techsupport.osisoft.com/Documentation/PI-AF-SDK/html/M_OSIsoft_AF_PISystem_Refresh.htm

Outcomes