I am having a problem with a tag history query.
I have a system that stores the history of numerous tags. The historical scan class is set to 10s and it will only write on change. This was done to minimize the communication because Ignition is running in the field and sending to a cloud db over a cellular connection.
I am using the historian to create on the fly batch reports. I run several queries for a particular time period and then move that data into various charts.
Most of the data being stored is from discrete tags. For the most part the query works great. I found that setting the returnSize=0 and aggregationMode=“LastValue” seem to give me good data. However, I have one tag where the data returned is incorrect.
If I look into the actual databases, I can see that the tag comes on at 12:03:40. However, my resulting queryTagHistory shows the tag coming on at 12:01:10. If I switch the returnSize to -1, then the query shows that the tag turned on at 12:03:40.
Unfortunately, I don’t seem to be able to run this query using the returnSize=0. This is because the top rows of the resulting dataset are null. I believe this is because the data was only writing to the db upon change. The queryTagHistory seems to leave the starting values for the tags at Null until it sees a value change.
Is there a way I should be setting the parameters in the queryTagHistory that will get me a dataset with no null values and correct values?