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

Tag name in trend Options · View
Danny
#1 Posted : Saturday, February 06, 2010 9:48:32 AM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
help me to change tag of a trend in process book using vb
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 : Saturday, February 06, 2010 11:02:24 AM
Rank: Administration

Groups: Administration

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

If you mean you wish to remove a trace and then add another, an example is below:

Code:

Sub ChangeTrace()

Dim T As Trend
Set T = ThisDisplay.Symbols("Trend1")

If T.TraceCount > 0 Then
    T.RemoveTrace 1    'Remove the first trace
    T.AddTrace "sinusoid" 'Add another trace
End If

Set T = Nothing

End Sub


Note that if you have multiple traces on a trend then you will need to loop through them to find the trace you wish to remove.

Cheers,

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Danny
#3 Posted : Sunday, February 07, 2010 3:02:29 PM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
Hi Rhys,

Thanks a lot for your quick reply and support.It is working fine .I did some addition to this .i.e. if you type a tag name in a 'text box' it will be added as a current trace.Now my question is ,Is it possible to enter a tag in the 'text box' using tag search.I mean by tag search the selected tag should enter to the 'text box'.(using Vb )

cheers,
danny
Michael
#4 Posted : Sunday, February 07, 2010 6:35:21 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Hi Danny,

The easy way is to use the tagsearch dialogue. First add a reference to PI-SDK Dialogs (if not done already add reference to the PISDK type libs). Then you show the dialogue and the selected tags are stored in a pointlist. (Remember, you can select more than one tag and the list can be empty)

Here is an example:

Private Sub cmd_tagsearch_Click()
Dim taglist As PointList
Dim tag As PIPoint
Set taglist = TagSearch.Show

For Each tag In taglist
' do what you want
Next tag
End Sub

Thats all.

Michael
RJK Solutions
#5 Posted : Monday, February 08, 2010 8:15:47 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Danny, as a sanity check is there any reason you are not using the built in ProcessBook interface for adding/removing PI Points to a trend?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Danny
#6 Posted : Wednesday, February 10, 2010 1:34:35 PM
Rank: Newbie
Groups: Member

Joined: 2/6/2010
Posts: 6
Hi Michael,

Thank u very much for your help and giving information about adding reference to PI-SDK Dialogs.I tried this and its working fine.

cheers,
Danny.


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.