I have been working with the PI Web API over the last few weeks. My research suggests the PI Web API does not provide access to PI Point annotations. Can anyone confirm or deny this?
It is not supported via PI Web API. What is the use case and could the annotations be stored in another tag/attribute and organized by AF element?
Hi Barry! Thanks for the clarification. My question for you or anyone following this post - Is there a method whereby one could display a pi point’s annotations in an AF Attribute? I beleive if there is a way to do that one could in turn retrieve it through the PI Web API.
As you know, a PIPoint can have more than one annotation. So what if you have 10 annotations in the PIPoint? Would you like to write them to a string array in an AFAttribute or write them to 10 separate AFAttribute. Just some food for thought. But either way, both method are possible using the AF SDK. Here is a sample code to retrieve the annotations of the snapshot of cdt158 that I entered via Processbook.
AFValue val = myPIPoint.Snapshot();
var anno = val.GetAnnotation() as AFAnnotations;
foreach (var item in anno)
I wrote out the value to the console but you can definitely use AFAttribute.SetValue to put this in an attribute etc.
There is currently no out-of-the-way to get the annotation value into another AF attribute. (You can, however, view the annotations in PSE, but this is not applicable in this use case.)
If we were to use AF SDK to achieve this, we need the ability to get the annotation value based on the time context, and each annotation value is associated with a particular PI value. One option I could think of is to create a custom data reference that grabs the annotation value of a referenced AF attribute. Building a custom data reference for this seems like an overkill, but might work for this use case.
Alternatively, you can also look into using a table lookup, and use PI OLEDB to get the annotations. However, you might want to take a look to see whether the annotations you are working with is structured/unstructured (for more information, refer to KB00961). I believe PI OLEDB can only directly read unstructured annotations.
What application is writing the annotations? Is using annotations necessary in your case?
I'm not sure an Annotation Viewer DR would be overkill, it would probably be a neat little solution that is compatible with standard PI clients.
I know this post is a little old, however I am wondering if Stephen Kwan has something in the roadmap regarding potential new Data References, generally speaking?
The plugin model is quite nice and I am wondering if we should encourage and help our community to build more of them or if OSIsoft also plan to create new ones as needed.
Disclaimer: Building a PI AF data reference can be complex and also can kill performances of other applications and sub-systems (e.g. PI Analysis Service, PSE, DataLink) if it does not behaves correctly. This is why we don't recommend easily to our customers to start a journey of building a Custom Data Reference. There are however situations where it can make sense assuming a correct level of performance can be achieved.
Thanks in advance Steve for your answers
Retrieving data ...