1 of 1 people found this helpful
You can absolutely write to PI Points from within ProcessBook but you will need to use VBA. Fortunately, as you predicted, the code is not that complex. If you have AF attributes configured using these points as their data reference, they will update automatically. Here is the code:
Dim newVal As Variant Dim server As PISDK.server Dim pipt As PISDK.PIPoint Dim tagsplit() As String Dim ptname As String newVal = InputBox("Enter new value for this tag") tagsplit = Split(ThisDisplay.Value1.GetTagName(1), "\") ptname = tagsplit(UBound(tagsplit)) Set server = PISDK.Servers("your server name") Set pipt = server.PIPoints(ptname) pipt.Data.UpdateValue newVal, "*" ThisDisplay.Refresh
1) You will want to stick this inside of a Sub that is tied to the click event for your value. This can be done up on top of the VB editor by selecting the symbol and then selecting the Click action:
2) Before this code can be run, you will need to add a reference to the PI SDK in the VB editor. You can do this by going to Tools > References and adding the PISDK 1.3 Type Library.
3) My code uses Value1.GetTagName(1) to get the name of the tag from the Value symbol configuration. You could also hardcode in the tag name for each value by swapping out server.PIPoints(ptname) to server.PIPoints("your tag name")
If you have any questions or trouble let me know!
If you want to write values back to PI, you will need to include VBA code.
The code in my first response writes to a PI Point. This PI Point value will be reflected in AF Attributes that have the point as part of their configuration.
If you are just reading data, no VBA code is necessary.