I’m trying to collect minimum, maximum, average and deviation values from tag history (basically to gather this aggregated data from each individual production run and to store it into a SQL table for that production run) and ultimately to move these values into an SQL table using a transaction group.
I know that with a report, I can generate this data relatively easily all at once using the “Tag CalculationQuery”. I’m not sure though how to use those values generated for the report can be used elsewhere as data. I’ve found the “system.tag.queryTagHistory” function, but I’m not sure if I can use multiple aggregate modes in the same query. Also, once I generate the dataset with the query, how to I collect the individual values from the dataset?
Currently, I have a table with the following script on mouseClicked:
endTime = event.source.parent.getComponent(‘Date Range’).endDate
startTime = event.source.parent.getComponent(‘Date Range’).startDate
dataSet = system.tag.queryTagHistory(paths=[’[default]Machine1/Annealer/OvenTemp1’], startDate=startTime, endDate=endTime, returnSize=1, aggregationMode=“SimpleAverage”, returnFormat=‘Wide’)
event.source.Returned = dataSet
The dataset is assigned to “Returned”, which I have set as a custom property on the table. The data is then linked to the custom property. I actually don’t even need this data in a viewable table, I just trying to figure out how to gather this data from the queries.
Any help is greatly appreciated.