Hi hello.
I have a issue regarding to the dataset obtained from a Tag History.
Im using this script:
endTime =event.source.parent.getComponent(‘Date Range’).endDate
startTime = event.source.parent.getComponent(‘Date Range’).startDate
data = system.tag.queryTagHistory(paths=["[default]L7/PNT/AlarmsMonitor/TransactionGroups/Spur05/Trigger_Spur05"], startDate=startTime, endDate=endTime , returnSize=0, aggregationMode = “Count”, columnNames = [“TimeStamp”, “Count”])
formattedData = system.dataset.formatDates(data, “HH:00”)
event.source.parent.getComponent(‘Power Table 1’).data = formattedData
The Information display like this:
Dataset Obtained form the TagHistory:
TimeStamp|Count|
|06:00|0|
|07:00|1|
|07:00|0|
|07:00|1|
|07:00|0|
|07:00|1|
|07:00|0|
|08:00|1|
|08:00|0|
|08:00|1|
|08:00|0|
|10:00|1|
|10:00|0|
|10:00|1|
|10:00|0|
|10:00|1|
|10:00|0|
|12:00|1|
|12:00|0|
|12:00|1|
|12:00|0|
|12:00|1|
|12:00|0|
Exists a script to group the dataset information by TimeStamp, and count all the number “1” on the column Count, just like the same Functtion “group by” that we use on SQL query.
“Example:”
TimeStamp|Count|
|07:00|5|
|08:00|2|
|09:00|10|
Thanks for your help and sharing knowledge