show date & time with PiACE

Discussion created by retetes on Apr 28, 2010
Latest reply on Apr 28, 2010 by hanyong


I have a problem with a equation inside Processbook, I want to show the last value and time before the actual value from the same tag with a function. To obtain this goal, I use a Pi ACE library which works fine in almost all tags, but in others tags the equation does not work. After look into processbook, I realized that the tags which fail only has one state change, and show me a wrong state and time.

This is the equation:

Function CambiaToolTip(nombreTM As String) As String
Dim a As Boolean
Dim p As PIACEPoint
Dim t As PITime

Set t = New PITime
Set p = New PIACEPoint

a = p.SetTag("labserver1", nombreTM, taTagAliasAsInput)

On Error GoTo NoEncuentra
t = p.FindNE("*", "*-30d", p.Value("*"))

CambiaToolTip = Format(t.LocalDate, "dd/mm/yyyy hh:mm:ss") & " Valor:" & p.NextVal(t)
Exit Function
t.UTCSeconds = DateTime.Now()
Resume Next

End Function