Skip to main content
Version: 8.1


New in 8.1.0

This function is used in Python Scripting.


Queries annotations stored in the Tag History system for a set of paths for a given time range.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.


system.tag.queryAnnotations(paths, [startTime], [endTime], [types])


List[String]pathsA list of tag paths to query. The paths are equivalent to what would be used for a Tag History Query, and should specify the Source Providers as well. For example, [HistoryProvider/Gateway:Provider]Path/To/Tag.
DatestartTimeThe start of the time range. If not defined, defaults to 12 hours ago. [optional]
DateendTimeThe end of the time range. If not defined, defaults to "now". [optional]
List[String]typesA list of string "types" to filter on. Types are defined by the annotations and various subsystems, and may vary with different providers. Possible annotation types are listed on the system.tag.storeAnnotations page. [optional]


List[Annotation] - A list of Annotation objects that match the query criteria.


Gateway, Vision Clients, Perspective Sessions

The Annotation Object

Properties on the annotation objects returned by this function can be references by name (i.e., Annotation.storageId). The table below represent properties on the object.

pathRepresents the tag path associated with the annotation.
typeRepresents the type of annotation.
rangeStartThe start time of the annotation.
rangeEndThe end time of the annotation.
dataAny data (such as a description, or user entered text) associated with the annotation.
storageIdRepresents the ID value of the annotation, as listed in the sqlth_annotations table. Used in conjunction with the system.tag.storeAnnotations to change existing annotations, and system.tag.deleteAnnotations to remove annotations.
deletedFlag representing if the entries are deleted or not.

Code Examples

Example #1
paths = ["[My-Provider]Station_1/ph"]
annotations = system.tag.queryAnnotations(paths)

for i in annotations:
print i.storageId


system tag queryAnnotations, tag.queryAnnotations