Check If Tag Exists on Server Using PI-SDK

Discussion created by rohanar on Jul 12, 2010
Latest reply on Aug 20, 2012 by Gregor

What is the best way to determine if a tag exists on a pi server using the PI SDK? My clunky solution is below -- is there a better way than trying to retrieve the PIPoint object and catching the error if the tag does not exist? Is there function for this?   Thanks in advance.

Dim MyPoint as PISDK.PIPoint  = GetPITag(MyTagName)

Dim TagExists as Boolean = MyPoint IsNot Nothing

Public Function GetPITag(ByVal TagName As String) As PISDK.PIPoint

        Dim PIPoint As PISDK.PIPoint = Nothing

            PIPoint = PIServer.PIPoints(TagName)
        Catch ex As Exception
            PIPoint = Nothing
        End Try

        Return PIPoint

End Function