3 Replies Latest reply on Apr 23, 2014 10:37 AM by asorokina

    Unable to delete Digital State/Error Value

    wpurrer

      Hello,

       

      I'm currently trying to delete digital states or error values from a PiPoint. I use the following Method:

       

       

       
      AFAttribute.DataReference.PIPoint.UpdateValue(afvalue, OSIsoft.AF.Data.AFUpdateOption.Remove);
      

       

       

      Deleting numeric Values works totally fine, but when it comes to deleting a digital state or error value like "Comm Fail" or "Not Connected", the function does nothing at all. The given AFValue Parameter is correct.

       

      Does anybody have some further information about this? Is it just not possible to delete error values using the AFSDK?

        • Re: Unable to delete Digital State/Error Value
          asorokina

          Hello Wolfgang,

           

          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();
          

           

           

           

           

          Kind regards,

           

          Anna

            • Re: Unable to delete Digital State/Error Value
              wpurrer

              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?

                • Re: Unable to delete Digital State/Error Value
                  asorokina

                  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.

                   

                  Kind regards,

                   

                  Anna