Skip to main content
Version: 8.3

system.historian.storeAnnotations

This function is used in Python Scripting.

Description​

Stores a list of annotations to the specified historian.

Changed in 8.3.5
Annotations can be provided as individual parameter lists or as objects created with system.historian.types.annotationPoint.

When provided as individual parameter lists, ensure all parameters are 1:1, meaning all provided lists must be of the same length. If a particular annotation doesn't need a parameter, that element can be None in the list.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax #1​

system.historian.storeAnnotations(paths, startTimes, [endTimes], [types], [data], [storageIds], [deleted])

Parameters​

TypeParameterDescription
ListpathsA list of historical paths. See Path Syntax for more information on recommended syntax.
ListstartTimesA list of start times associated with the annotation.
ListendTimesA list of end times associated with the annotation. [optional]
ListtypesA list of string types that indicate the annotation type. [optional]
ListdataA list of annotation data. [optional]
ListstorageIdsA list of annotation storage IDs to indicate that the annotation should be updated. [optional]
ListdeletedA list of deleted flags to indicate whether the annotation should be marked deleted. [optional]

Returns​

List - A list of QualityCode objects. The quality code will indicate success or failure.

Scope​

Gateway, Vision Client, Perspective Session

Syntax #2​

system.historian.storeAnnotations(annotations)

Parameters​

TypeParameterDescription
ListannotationsA list of annotations objects created with system.historian.types.annotationPoint.

Returns​

List - A list of QualityCode objects. The quality code will indicate success or failure.

Scope​

Gateway, Vision Client, Perspective Session

Code Examples​

Syntax #1 Code Snippet
# Store an annotation on a tag and log an info level formatted message. 

paths = ["histprov:HistorianB:/sys:gw1:/prov:default:/tag:remote_200"]
endTimes = [system.date.now()]
startTimes = [system.date.addSeconds(endTimes[0], -5)]
types = ['note']
data = ['this is a test']

result = system.historian.storeAnnotations(paths, startTimes, endTimes, types, data)

system.util.getLogger('HistorianTest: storeAnnotations').info(str(result))
Syntax #2 Code Snippet
source = "histprov:SQL_Historian:/sys:GW1:/prov:default:/tag:test_tag"
startTime = system.date.now()
data = "Annotation text"
annotations = [system.historian.types.annotationPoint(source=source, startTime=startTime, data=data)]

system.historian.storeAnnotations(annotations)