9 Replies Latest reply on May 27, 2011 6:00 PM by janio

    Retrieving miliseconds with PITimeFormat




      I am developing an aplicattion with VBAplication for excel using PISDK and I cannot retrieve the miliseconds of TAG.


      When I get the values of TAG with the PI Data Link, I can retrieve the miliseconds without problems.


      I am using this code (it is in primary stage of development):


      Dim PIServer As PISDK.Server
      Dim ConnectionString As String
      Dim ListaTags As PISDK.PointList
      Dim oValues As New cTAG
      Dim varvalor As New PISDK.PIValue
      Dim varvalores As New PISDK.PIValues
      Dim varpoints As New PISDK.PointList
      Dim varpoint As PIPoint
      Dim dataini As New PITimeFormat
      Dim datafim As New PITimeFormat
      Dim i As Integer
      Dim j As Integer


      dataini.InputString = Str(CDate(Cells(1, 1)))
      datafim.InputString = Str(CDate(Cells(2, 1)))
      i = 0
      j = 3


      'Set the Connection String.
      ConnectionString = "UID=piadmin;PWD=piadmin;SERVERROLE=XXXX;"


      If PIServer.Connected = False Then
          PIServer.Open (ConnectionString)
      End If


      Set ListaTags = PIServer.GetPointsSQL("PIPOINT.TAG LIKE '*.soe'")


      For i = 1 To ListaTags.Count
         Set varpoint = ListaTags(i)
         Set varvalores = varpoint.data.RecordedValues(dataini, datafim, btInside)
         For h = 1 To varvalores.Count
              Cells(j, 4) = varpoint.name
              Cells(j, 5) = varpoint.PointAttributes.Item("descriptor")
              Cells(j, 6) = varvalores(h).TimeStamp.LocalDate
              Cells(j, 7) = varvalores(h).Value
              j = j + 1

      End Sub


      Can Anyone help me?


      Thank you