1 Reply Latest reply on Aug 18, 2015 5:56 PM by Dan Fishman

    Deleting data from a PI Collective using PI SDK

    OscarGarciaLino

      I have an application running on excel which has the option to insert or delete data from the archive servers. Everything works fine but I am having issues when trying to delete the snapshot value for a tag.

      In the code, I use IPICollective to connect individually to each collective member and delete the data. The process is as follows:

      1.- Connect to one collective member (primary member).

      2.- Get the tag name, get period of time to delete data (start and end time)

      3.- Delete the data using the following line of code: ptTag.Data.RemoveValues dtmTimestamp, EndTimestamp, drRemoveAll

      4.- Disconnects from current collective member.

      5.- Connect to next collective member (secondary member) and repeat steps 2 to 4.

       

      The application removes the data but it does not remove the snapshot value, and the following error is displayed: "Failed to remove one or more requested events. [0] Success".

      The application runs from a client machine, and buffering is enabled to properly update the data in the collective when choosing the insert values option in the application.

       

      Why Data.RemoveValues does not remove the snapshot value? Is there any other function I could use or how could I make my application to support snapshot values delete?

       

      Thanks,

      Oscar

        • Re: Deleting data from a PI Collective using PI SDK
          Dan Fishman

          My guess is you have a buffer lock on the point preventing you from deleting the value in the snapshot table.  If there is such a lock, you can't enter data after the snapshot value unless you buffer the data write.  This also means, you are unable to delete the snapshot data as well until the buffer lock expires.

           

          You should be able to confirm this behavior by using PI SMT archive editor to delete the value manual and should see a similar message to confirm this.  You could wait for the buffer lock to expire or you could reset the buffered severs list as describe in KB00093