If just open one .pdi file from another one, "Button" function could do it. However, this could only used to "open". If you need to transfer some data/parameter from one .pdi to another one, please read this thread.
Thanks Xi Wang.
If I just want to get the value B.PDI's txtPath = A.PDI's txtPath, any simple code can be use?
From my understanding, there is an enhancement request for this which was not implemented yet. Nevertheless, you could exchange information between displays through a text file or by updating values on the PI Data Archive or PI AF Server. If you want to store data in AF, you will have to use the AF Wrapper in order to access the PI AF Server from PI ProcessBook. If you store on the PI Data Archive, just create a string PI Point and you can get the snapshot string or update it through PI SDK. In this case, don't forget to add the PI SDK library to the references of the display.
Hope it helps!
If change to use "Button" function, how to do it? Any example or code for reference?
Hi Thomas, could you provide more details about what do you want to do with the button in this context of sharing data between two displays? Do you want an example to store/retrieve data in the PI Data Archive with PI SDK?
As question <<vcampus.osisoft.com/.../5623.aspx>>. In the question, I used rectangle to call out a PDI with corresponding trend. If user want to reset this counter, I need to know reset which pi tag and display corresponding unit showed in the Title.
There may be help :
I use "d1.trend1.AddTrace(\\server\PItagname) to add a tag name in the trend(called out PDI).
How can I get back all information at "d1.trend1.AddTrace(\\server\PItagname) in coding ? If I don't know added what tag name in trend, how can I get out all tag name added in the trend?
Private Sub MC1_Click(ByVal lvarX As Long, ByVal lvarY As Long)
Dim d1 As Display
Set d1 = Application.Displays.Open(ThisDisplay.txtPath.Contents & "Motor Running Current.PDI", True)
d1.txtType.Contents = "//servername/pitagname" <<<<<<<<<<<<<<<<<<----------------------- that is the coding I want
Let’s separate our concerns concerning the display. The trends are used to display data and not to save the states or exchange information between two displays. The example below shows you how to save data/status of the display on PI Pointsa.
I have created two displays: GetStatus.pdi and SetStatus.pdi. I have also created a PI Point called PBTypeStatus which will save the type selected on the SetStatus display (0 for TypeA and 1 for TypeB).
On the SetStatus display, I am using the following code snippet:
Public Sub SetTypeA() SaveType (0) End Sub Public Sub SetTypeB() SaveType (1) End Sub Public Sub SaveType(value As Integer) Dim myServers As PISDK.Servers Dim myServer As PISDK.Server Dim myPIPoint As PISDK.PIPoint Dim mySnapshotValue As PISDK.PIValue Set myServers = PISDK.Servers Set myServer = myServers("MARC-PI2014") Set myPIPoint = myServer.PIPoints("PBTypeStatus") myPIPoint.Data.UpdateValue value, TimeStamp, dmInsertDuplicates, Nothing End Sub
On this display I have created two buttons. The first will call function SetTypeA() and the second will execute function SetTypeB().
On the second display GetStatus, it reads the snapshot from the same tag and then is able to update the PI ProcessBook objects. In my case, I am display different messages, but you can apply the logic that you want to.
Public Sub GetStatus() Dim myServers As PISDK.Servers Dim myServer As PISDK.Server Dim myPIPoint As PISDK.PIPoint Dim mySnapshotValue As PISDK.PIValue Dim myType As String Set myServers = PISDK.Servers Set myServer = myServers("MARC-PI2014") Set myPIPoint = myServer.PIPoints("PBTypeStatus") Set mySnapshotValue = myPIPoint.Data.Snapshot If CInt(mySnapshotValue.Value) = 0 Then MsgBox "Status saved on the PI Server: Type A" Else MsgBox "Status saved on the PI Server: Type B" End If End Sub
Hope it helps you!