Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Writing back to Processbook Display using VBA

$
0
0

Hello,

 

I am attempting to create a script that will take in a date selected by the user and then output the value of a specific Tag for that point in time.

 

I originally tried setting up Value boxes for each tag (on a processbook display) but I could not determine if they could display data for specific dates (they would only display real-time data).

 

Next I set up the code seen below. Here I am retrieving the Tag values at the time entered into a Microsoft Date and Time Picker on the processbook display. The problem I need help with is writing the retrieved value back to the display.

As seen in the last two lines of the code, I attempted to write the data out to a Label and Text box created on the display but keep getting a run-time error, saying OBJECT REQUIRED.

 

If anybody has some suggestions that would be great!...

 

 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim disp As Display
    Dim val As Value
   
    Set disp = Application.ActiveDisplay       
   
    newDate = disp.NewDatePicker.Value
    dateString = CStr(newDate)      

    Dim srv As Server
    Dim pt As PIPoint
    Dim pv As PIValue 
    Dim dt As New PITimeFormat
   
    Set srv = PISDK.Servers.DefaultServer
   
    dt.InputString = CStr(dateString)

   

    Set pt = srv.PIPoints(Text3.Text)                 ' Tagname retrieved from textbox on display

  
    Set pv = pt.Data.ArcValue(dt, rtAuto)

   

    'Label1.Caption = CStr(pv.Value)
    'Text3.Value = CStr(pv.Value)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>