YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Unknown Tag Name Options · View
JohnsNotHere
#1 Posted : Thursday, June 25, 2009 7:58:26 AM
Rank: Newbie
Groups: Member

Joined: 6/25/2009
Posts: 2
Hi all

If I want to get a PIPoint I use the code:

PISDK.PIPoint pnt = _server.PIPoints[tagName];

If the tag name does not exist an exception is raised. I would like to avoid getting an exception raised if possible with something like the .NET dictionary uses:

if (_server.TryGetValue(tagName, out pnt))
// Process

or

if (_server.Contains(tagName))
pnt = _server.PIPoints[tagName];
// Process

These methods are not supported by the PIPoint collection, so is there any other way? I tried the PointLoaded method but this appears to not work (or it may be for something else entirely... PI help does not have a reference to it)

Cheers,

John
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Thursday, June 25, 2009 9:32:20 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hi John,

You could always use GetPoints method to check for tag name existance.
GetPoints returns a PointList object so you just use the Count as an indication if the tag exists.

If _server.GetPoints("tag='sinusoidd'").Count > 0 Then
'Point Exists
Else
'Point does not exist.
End IF

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
JohnsNotHere
#3 Posted : Friday, June 26, 2009 12:49:23 AM
Rank: Newbie
Groups: Member

Joined: 6/25/2009
Posts: 2
Thanks Rhys... just what I was looking for
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.