Tag Archives: piserverprogramming

Read and Write A Tag Value From PI-Server Using PI-SDK Through VBA (Visual Basic)

13 Mar

Reading a tag value from PI-Server

Private Function TargetValue()
Dim valueRet As String
Dim srv As Server
Dim dt As New PITimeFormat
Dim pt As PIPoint

Dim MYPIServer As PISDK.Servers
Set srv = PISDK.Servers.DefaultServer

TargetValue = srv.PIPoints(“Target”).Data.Snapshot

‘ Target is the tag name here.
End Function

Writing a tag value to PI-Server

‘***************************Writing into Target Tag****************************
Private Sub WriteTargetInstructionPI()
Dim srv As Server
Dim dt As New PITimeFormat
Dim pt As PIPoint

Dim MYPIServer As PISDK.Servers
Set srv = PISDK.Servers.DefaultServer

TagName = “Target”
Set pt = srv.PIPoints(TagName) ‘ it’s your PI point

dt.InputString = “*”        ‘it’s data. InputString – Converting String in PIdata format

pt.Data.UpdateValue TextBoxTarget.Text, dt, dmReplaceDuplicates ‘function for Update (reed help)

End Sub

 

Note: I have used Sub for writing the tag value and Function for reading tag value for my own business logic. You can use either Function or Sub according to your own requirements.

How to find PI SDK/Server Documentation (Programming Guide)?

17 Oct

When I started PI Server Programming the first problem I got, was to find the programming guide/documentation of PI SDK. So I Googled it but unable to find the documentation. Yesterday I was desperate to find the PI Server Documentation so I tried random. Finally I was very happy when I was successful. Actually it was very easy.

So I decided to write about it.

Here is a step by step process