2 Replies Latest reply on Apr 2, 2012 6:44 AM by MNiedba

    New PI-SDK 2010 R2 (1.4.0) - How to chek if given PI Point exist on server?




      After switching to new PI-SDK (1.4) I have got a problem with checking if given PI Points exist on the PI Server.
      I keep the name of the PI Point that I want to check as string variable.
      Prior to 1.4 I have was just trying to get a PISDK.PIPoint object from the PISDK.PIPoints server collection by the string indexer.
      When my result was null, then I was assuming that such PI Point does not exist on server.

      Now after switching to 1.4 I have realized that this approach does not work.
      Now calling the string indexer on PISDK.PIPoints collection returns a regular object, even for PI Points that do not exists.
      Only when I will try to get any attribute from such PI Point I will get the COMException with psePIPOINTDELETED code.

      I think that such approach, when I need to check an attribute to be sure that point does not exists is not very nice.
      Is there any other solution which I can use to be sure that given PI Point does not exists? Or maybe I am doing something wrong?

      Thank you for help.

        • Re: New PI-SDK 2010 R2 (1.4.0) - How to chek if given PI Point exist on server?

          @Marek: Normally the psePIPOINTDELETED error is returned when a point is deleted on the server and a PI SDK application already holds a PIPoint object for that point. When this error is received, it indicates that the PIPoint object is no longer valid. The application should release its reference to the PIPoint object. If an application, when receiving this error, suspects that a point was deleted and a new tag of the same name was added (perhaps to change the pointtype), the application can retrieve the PIPoint again from the Servers PIPoints collection. This retrieval will either succeed, returning the new point of that name, or fail if there is no such point on the server.


          If the local PISDK (top-level) object you are using is not refreshed, the tag was previously used in the application and it is then deleted by an outside application or a different thread using a different PI SDK connection, you will be in a desynchronization problem. You would need to refresh the cache of this PISDK (top-level) object or request another reference of the same PI Point.


          Have you manipulated the point to remove it and re-create it? Do you know if another process could have deleted the PI Point? Is it the only PI Point affected? What was the version of PI SDK used before that returned you a Null value when the PI Point did not exist?
          The normal behavior is that when a PI Point does not exist an exception is generated.