proberts

PIPoint example code in PI-SDK help problem

Discussion created by proberts on Sep 2, 2011
Latest reply on Sep 6, 2011 by proberts

I'm attempting to get the annotations of a particular PI tag, and have used as a template the example  in the PI-SDK chm file, though modified for VS 2010.

 

 

 
Private Function getValAttributes(ByVal pv As PISDK.PIValue, ByVal sAttr As String) As String 
Try
  Dim nvAttr As PISDKCommon.NamedValue 
  Try
    nvAttr = pv.ValueAttributes(sAttr)
  Catch
    Return "N/A" 
  End Try 
  If VarType(nvAttr.Value) = vbBoolean Then 
    If nvAttr.Value Then 
      Return "True" 
    Else
      Return "False" 
   End If 
  Else
    Return nvAttr.Value.ToString 
  End If 
  Catch ex As Exception 
    MsgBox(Err.Description)
  End Try 
  Return "" 
End Function

This code only ever return "N/A"...  I notice in the original code there was on error resume next - is there a trap missing or something??

 


Call with getValAttributes(pv, "Annotations") having previously set up pv...

Outcomes