I wonder if anyone knows how (or if its even possible) to alter the data that can be exported from a powerchart. Our tags store history on change, so the time stamps of those changes are super variable. Instead, I would like to just export the values of all tags every 30 seconds, rather than every change. Any advice?
I donât know if you can alter the behavior of the power chart. You can put this script in a separate button. It will query the tag historian and return a dataset with a value every 30 seconds. You can use either system.dataset.exportExcel or system.dataset.toExcel + system.perspective.download to âexportâ to the user.
Note: Property names are vision syntax. Replace these properties with the appropriate Perspective properties and you can use it there too.
Script:
data = system.tag.queryTagHistory(
# you can have more than one tag path in the list. They'll show up as separate columns
['tagPath'],
startDate=event.source.parent.getComponent('Easy Chart').startDate, # replace
endDate=event.source.parent.getComponent('Easy Chart').endDate, #replace
aggregationMode='Average', #read about various aggregation modes. Pick the one you like
columnNames=['tagValue'],
intervalSeconds=30, # only available in 8.1.0 or later
noInterpolation=0 # Investigate whether you want this on or off
)
# this line is for testing. You'd actually want to do something with the dataset.
event.source.parent.getComponent('Table').data = data
Iâm not used to Perspective, but perhaps you could change the Power Chart mode to âhistoricalâ and then use a script that just updates the start date and end date properties of it.