I have been using the system.tag.queryTagHistory() function for a little while now.
Generally I have used it on the ‘Ignition’ Tag Historian data to return tag history interpolated at a minimum interval of 1 minute or at the scan rate of the specified tag path/s.
I now have a requirement to return interpolated historical data from an OPC-HDA server at intervals less than 1 minute, in this case, 15 seconds.
I know Ignition can retrieve and interpolate historical data from the OPC-HDA server at a 15 second interval because I was able to do so with the tag history binding on a table and chart in Vision and Perspective. However, when i use the system,util.queryTagHistory() function, it will only give me a minimum interval of 1 minute (Example script below).
If you set your ‘returnSize’ based on your range and interval it should give you want you want. Where you are looking at a 5 minute range. set it to 20 instead of -1. -1 will return values on change. Setting it to 20 you will get 20 results evenly space so a 15 second interval over 5 minutes.
There’s a longstanding ticket to add intervalSeconds/rangeSeconds to the queryTagHistory function that I’ve added you to. We’re also planning to introduce a few new, simplified functions for specific types of history queries - they’ll still be doing the same thing as queryTagHistory, but specifically designed for, say, retrieving the value at a particular timestamp without having to specify all the arguments manually.