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

How to request tag list programmatically Options · View
Gary
#1 Posted : Monday, February 09, 2009 2:14:00 AM
Rank: Newbie
Groups: Member

Joined: 2/9/2009
Posts: 2
Thanks for this site it has been really helpful Smile

What I would like to know; is there a function that can call programmatically to search the OSI Server for tags without creating the search dialog? I would like to simply get the tags on application startup (and refresh) and display the tags to the user in a combo box. I cant seem to find a way of doing this without the search dialog.

EDIT: I am using PI SDK version 1.3.9.4 from May 2004 and developing in C# Visual Studio 2005 on Windows XP I believe our server is around 2 years old (if this helps)

Cheers
Gary.
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 : Monday, February 09, 2009 9:24:48 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Gary,

Welcome.

You can do this from the PISDK.Server object once you have opened a connection, just use the PIPoints property.

Example:

VB.Net (Assumptions, ListBox1 is a win forms listbox control, PIServer is a variable of type PISDK.Server).
Code:

For Each PIPnt As PISDK.PIPoint In PIServer.PIPoints
   listbox1.items.add("\\" & PIServer.Name & "\" & PIPnt.Name)
Next


You can also use PISDK.Server.GetPoints to narrow down your search for PI tags. It is worth reading up on this method too.

Hope this helps.

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Gary
#3 Posted : Monday, February 09, 2009 9:38:44 PM
Rank: Newbie
Groups: Member

Joined: 2/9/2009
Posts: 2
Thanks Rhys.

Exactly what I wanted to know. Its a round about way of getting what I want but works none the less. Thanks for being so quick too.

I didn't find the help provided with the SDK to be all that useful (which is why I am here) and as this is my first time interfacing to an OSI PI server my impressions are that it seems to be based on very old technology and quite confusing.

This code works for me:

Code:
       
        public static bool ReadTagNameList(string piServerName, Collection<string> piTagNames)
        {
            if ( string.IsNullOrEmpty(piServerName) || piTagNames == null)
                return false;

            PISDK.PISDK piSDK = new PISDK.PISDKClass();

            piTagNames.Clear();
            foreach (PISDK.PIPoint p in piSDK.Servers[piServerName].PIPoints)
                piTagNames.Add(p.Name);

            return true;
        }


Edit: we refer to osi points as tags due to the original source of the information being recorded (sorry if this confuses anyone)

Cheers
Gary.
RJK Solutions
#4 Posted : Monday, February 09, 2009 10:19:27 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Gary, no worries weven OSI themselves refer to tags and PIPoints in the same sentence. I always use tag rather than point.

Depends on your PI system size, this routine may become a bit resource expensive (imagine doing this for a 500k tag system). I guess it depends on what you want to display the PI tags for. GetPoints and GetPointsSQL come into play when you are searching for specific tags (this is same "engine" for the Tag Search dialogue) or types of tags (pointsource, pointtype, status).

Just keep asking questions and I will no doubt keep answering! :-)

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
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.