|
|
Rank: Newbie Groups: Member
Joined: 2/6/2010 Posts: 6
|
help me to change tag of a trend in process book using vb
|
|
|
|
|
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 311 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. OSISoft PI System SpecialistsPI Consultancy on PI Systems, Analysis Framework, PI custom developments and all things PI.
|
|
|
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
|
|
|
Rank: Advanced Member Groups: Member
Joined: 12/3/2009 Posts: 49 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
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 311 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? OSISoft PI System SpecialistsPI Consultancy on PI Systems, Analysis Framework, PI custom developments and all things PI.
|
|
|
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.
|
|
|
|
Guest
|