AnsweredAssumed Answered

Reading annotations with AF-SDK 2014

Question asked by GeethaDean on Apr 20, 2015
Latest reply on Jun 15, 2015 by gregor

I am using the 2014 edition of the AF-SDK, attempting to read annotations from individual events in PI. I am reading data from PI by iterating over an AFValues collection. See my code below.

 

AFValues values = pt.RecordedValues(timerange, OSIsoft.AF.Data.AFBoundaryType.Inside, String.Empty, true);
foreach (AFValue value in values)
{
     double val = Convert.ToDouble(value.Value);
     DateTime timestamp = value.Timestamp.LocalTime;
}

 

Within AFValue there exists AFValue.GetAnnotation(). I cannot figure out the purpose of this method, nor can I find anything in the help file.

 

So I then try the following method:.

 


if(value.Annotated)
{
     string annotation = pt.GetAnnotation(value).ToString();
}

 

But my problem then is that AFValue.Annotated always evaluates to false, even when I can look in SMT and see that the event has an annotation.

 

Can anybody offer any input?

Outcomes