4 Replies Latest reply on Mar 3, 2014 5:02 PM by ChewCheeLim

    Deleting A PITAG and it's associated data. (all)

    ChewCheeLim
      Hi, I would like to delete a pitag and its associated data. Looked up AFSDK help doc and also search on vCampus, it seems like there is no straight 'Delete' methods to do it. What I want to do is the following:- When an Element is removed, I want to clean up all associated PIPoints and data. Is using PI OLEDB a better way than AFSDK ? any advice is greatly appreciated.
        • Re: Deleting A PITAG and it's associated data. (all)
          mhamel

          @Chew: The OSIsoft.AF.PI.PIServer class (AF SDK 2.5 used with .NET Framework 4.x) exposes a DeletePIPoint method to remove what you want.

           

          If you refer to classic PI OLEDB provider, yes it can remove PI Points but it is based on PI SDK. If you refer to PI OLEDB enterprise provider, you don't have these options to create/update/delete metadata (PI Points, AF Elements, etc.) So the latter is not an option to use.

           

          Your question points me to another question: "How do you handle wrong deletion?" What if someone hits the remove button but changes his/her mind or made a mistake and pick the wrong one. If you make this process end-to-end you won't be able to revert back. If you delete the metadata (in AF) and mark the PI Points for deletion to be executed at a later time you could avoid this tricky problem. Remembering my old time as a PI admin, I was never deleting the tags right away but kept this in a pool marked for deletion. I was processing them twice a year (of whatever other period would suit your needs). That saved me many times from these types of mistakes.

           

          One easy way to create this pool of tags is by using the Point Source. They are easily traceable.

           

          I hope this helps!