AnsweredAssumed Answered

Is there a way to make sure all the events for a tag were deleted before continue with PI AFSDK?

Question asked by rsun on Apr 3, 2015
Latest reply on Apr 6, 2015 by dng

I was trying to delete PI Data Archive events for a tag with PI AF SDK. All the code got executed, but I found out that the events were still existed within the PI Data Archive upon checking with PI SMT Archive editor. However, after waiting a couple of minutes, all the events for the specified tag got deleted between the time range. I could put sleep method before continue, but is there a method to use to make sure all the events for a tag were deleted before continue execute to the next tag? Thank you.

 

PIServer server = new PIServers()["PISERVERNAME"];

PIPoint tag = PIPoint.FindPIPoint(server, "TAGNAME");

AFTimeRange timeRange = new AFTimeRange("StartTime", "EndTime");

AFValues tagValues = tag.RecordedValues(timeRange, OSIsoft.AF.Data.AFBoundaryType.Inside, "", false, Int32.MaxValue);

List<AFValue> list = new List<AFValue>();

foreach (AFValue tagValue in tagValues)

tag.UpdateValues(list, AFUpdateOption.Remove);

 

Message was edited by: Ricky Sun

Outcomes