Which version of AF SDK do you use? Can you try it with the latest AF SDK 2.6? It requires .NET 4.5 and therefore Visual Studio >=2012.
On my test environment it works fine, and it's able to delete Digital state from tag data with no issues. Code is below.
If you're already using 2.6 version and still getting this issue, please check the message log for "addevent failed" errors in the PI SMT->Operations->Message Log.
PIServer myPIServer = new PIServers().DefaultPIServer; myPIServer.Connect(); AFTime Time = new AFTime("22-Apr-2014 12:05:50"); PIPoint point = PIPoint.FindPIPoint(myPIServer,1); AFValue Value = point.RecordedValue(Time,OSIsoft.AF.Data.AFRetrievalMode.Exact); Console.WriteLine(Time.ToString() + " " + Value.ToString()); point.UpdateValue(Value, OSIsoft.AF.Data.AFUpdateOption.Remove,OSIsoft.AF.Data.AFBufferOption.DoNotBuffer); Console.ReadKey();
Thank your very much for your response Anna!
I finally figured out what my problem is:
I'm connected to PIServer X and I'm dynamically creating an AFAtrribute with a PiPoint from PIServer Y. Thus im not able to write to a PiPoint on a different Server than I'm connected to. What would you suggest? Can i connect to multiple Servers at the same time?
Yes, you can definitely connect to several PI Servers at the same time.
I need your help with understanding from which PI Server you'd like to remove bad values.
If you'd like to remove bad values from PI Server Y tag, then just create a new PI Server and Connect() to it.
If you'd like to remove bad values from PI Server X, then points should refer to PI Server X. When you define attribute's ConfigString, do you use something like "%server%\tag"? %server% will be translated to a default PI Server on your system.