Hello My Fellow PI in they eye geeks:
I am facing a surprising challenge. In an ASP.net application (coded using Visual Basic) I have a loop to output an AF Element's temperature attribute's values, timestamps and annotations.
================== Here is my code that throws no errors ========================
Dim values As AFValues = selectedAttribute.GetValues(timeRange, 0, desiredUOM) Dim desiredAnno As Object '# Build a table of values and timestamps: Response.Write("<table>") For Each tempValue As AFValue In values desiredAnno = tempValue.GetAnnotation If (desiredAnno Is Nothing) Then Response.Write("<tr><td>" + tempValue.ToString + "°C</td><td>" + tempValue.Timestamp.ToString + "</td><td> </td></tr>" & vbCrLf) '~ hard coded UOM abbreviation Else Response.Write("<tr><td>" + tempValue.ToString + "°C</td><td>" + tempValue.Timestamp.ToString + "</td><td>" + desiredAnno.ToString + "</td></tr>" & vbCrLf) End If Next 'Response.Write("</table>" & vbCrLf)
========================= End Code ============================================
I get this output using 'Object' data type for the variable 'desiredAnno':
18.63791847229°C 7/9/2014 4:41:34 PM OSIsoft.AF.Data.AFAnnotations
18.6298904418945°C 7/9/2014 4:42:04 PM OSIsoft.AF.Data.AFAnnotations
18.6219100952148°C 7/9/2014 4:42:34 PM OSIsoft.AF.Data.AFAnnotations
18.6139793395996°C 7/9/2014 4:43:04 PM OSIsoft.AF.Data.AFAnnotations
18.6061000823975°C 7/9/2014 4:43:34 PM OSIsoft.AF.Data.AFAnnotations
I want to see:
18.63791847229°C 7/9/2014 4:41:34 PM The Annotation Here
18.6298904418945°C 7/9/2014 4:42:04 PM Another Annotation Here
18.6219100952148°C 7/9/2014 4:42:34 PM The Third Annotation
18.6139793395996°C 7/9/2014 4:43:04 PM The Fourth Annotation
18.6061000823975°C 7/9/2014 4:43:34 PM The Fifth Annotation
I get a big fat error and variations of errors when I use the 'AFAnnotation' data type
I know there is a way to get the value of the annotations using PISDK, but I can't seem to get the values using AFSDK. After hours of testing variations of the code I am open to suggestions for how to retrieve the values of the annotations.
¡Muchas Gracias!