Hi,
I’ve got an easy chart which retrieves data based on the tags and time span selected by user. From the data retrieved I’d like to display the maximum value (and the average if possible) of a particular tag (the chart displays 4 tags).
I’m using the following code:
#get values from temperature for maximum and average
if event.propertyName in ('startDate', 'endDate'):
startDate = event.source.startDate
endDate = event.source.endDate
tagPath= '[default]Retort 1/Retort 1 Temperature'
Max = system.tag.queryTagHistory(paths= [tagPath],
startDate=startDate,
endDate=endDate,
returnSize=1,
aggregationMode='Maximum')
# Avg = system.tag.queryTagHistory(paths= [tagPath],
# startDate=startDate,
# endDate=endDate,
# returnSize=100,
# aggregationMode='Basic Average')
event.source.parent.getComponent('Max').value = Max
# event.source.parent.getComponent('Avg').value = Avg
When I test my display, I get an error
TypeError: can’t convert Dataset [1R ⅹ 2C] to double
I use similar scripting to calculate volumes, and don’t get these same convert errors. Is there some way to change the Numeric display to not require a double integer (tag uses integer values)? Some other way to just get the maximum value from that dataset?