paths = [u"[Laboratory]炉上温Up"]
annotations = system.tag.queryAnnotations(paths)
for i in annotations:
print i.storageId
What is i.storageId
supposed to return? It's not a column in the data table. Do you mean annotationid
?
paths = [u"[Laboratory]炉上温Up"]
annotations = system.tag.queryAnnotations(paths)
print annotations
Just print annotations is empty?
paths = [u"histprov:Laboratory:/drv:Ignition-Win10-2022WCACW:/prov:Laboratory:/tag:TestTag222",
u"histprov:Laboratory:/drv:Ignition-Win10-2022WCACW:/prov:Laboratory:/tag:TestTag"]
startTime=system.date.addDays(system.date.now(), -30)
endTime = system.date.now()
types = ['note']
annotations=system.tag.queryAnnotations(paths, startTime, endTime,types)
print annotations
for item in annotations:
print item
print item.data
How to get all path in Laboratory or can filter the tag?
paths=[u'histprov:Laboratory:/drv:Ignition-Win10-2022WCACW:/prov:Laboratory:/tag:*']
I use system.tag.browse to filter the tag, then use system.tag.queryAnnotations .
newpath =[]
results = system.tag.browse(path ="[Laboratory]",filter = {'name':'*炉*'})
defaultpath ='histprov:'+self.view.custom.histprov+':/drv:'+self.view.custom.drv+':/prov:Laboratory:/tag:'
for result in results.getResults():
itemPath = str(defaultpath+str(result['fullPath']).split(']')[1]).decode()
newpath.append(itemPath)
startTime=system.date.parse(self.view.params.startDT, 'yyyy-MM-dd HH:mm:ss','en')
endTime=system.date.parse(endTime, 'yyyy-MM-dd HH:mm:ss','en')
types = ['note']
annotations=system.tag.queryAnnotations(newpath, startTime, endTime,types)