1 Reply Latest reply on Dec 12, 2017 7:54 PM by RalfBorowski

    PIPoint.UpdateValue not working for me in VB.NET using SDK from AF 2017

    RalfBorowski

      Hello all, I'm new to the AF SDK and having a hard time with the updatevalue and updatevalues methods of the pipoint class. I am converting to PI from another historian and want to backfill tag data from the old historian to PI so users will be able to trend, compare current to historical operating values and so on. To begin with, I created a series of archives on the PI server to hold the historical data, as I read somewhere on these forums, but the data I am starting to test with has timestamps that would insert it into the current "live" archive regardless. When I execute the code below, and inspect all variables through the VB debugger, everything seems to work, and no errors are captured. However, I see no values in SMT->archive editor. I can manually create the values in SMT so it doesn't seem to be a permissions issue as far as I can tell. Code snippet below:

       

      Dim DataElements As String()

      Dim myPoint As PIPoint = Nothing

      Dim newTime As AFTime = New AFTime

       

      'DataElements contains {(30-Nov-2017 20:34:08.000) (OK) (9.6)}

      If PIPoint.TryFindPIPoint(myPIServer, "MyTagName", myPoint) Then

          If DataElements(1) <> "BAD" Then

                 If AFTime.TryParse(DataElements(0), newTime) Then

                    Dim newValue As AFValue = New AFValue(DataElements(2), newTime)

                    myPoint.UpdateValue(newValue, AFUpdateOption.InsertNoCompression, AFBufferOption.DoNotBuffer)

                 Else

                    MsgBox("couldn't parse the time")

                 End If

           End If

      End If

       

      Originally, I was using the UpdateValues with a list of AFValues, but when that didn't work I simplified to single points. Any help will be greatly appreciated.

      R