Forcing rows in queryTagHistory

Is there a way to force queryTagHistory to put rows into a dataset even when there is not data during the selected time period? For my script to calculate accurately I can’t have the dataset skipping days. Even if there isn’t any data. I’d rather it return 0’s than to simply omit those days.

See attached for example.


I noticed that you are basically getting values once a day at the same time every day, if that’s the case, you may be able to get what you want by setting the intervalHours argument to 24. That should return a new row for every 24 hour time period. That should work as long as you aren’t also supplying a returnSize argument. You may also need to set the noInterpolation argument to True.

I am not supplying a returnSize argument. It appears that setting the noInterpolation argument to False forces it to insert the data for the missing rows. It also doesn’t appear to affect the values on the rows we have data for.

I wonder if interpolation would have a more drastic affect if we had intermittently missing data in historian?

It looks like you are right. There doesn’t seem to be an easy way to do this with what we have provided. Like you said, with noInterpolation set to False you will get values where there probably wasn’t any values and that’s not a great solution. You may just have to use our system.dataset script functions to insert those rows in manually where there are gaps.

I meant to say that setting interpolation to False seems to add the rows. I’m just a little concerned that interpolation may cause an ever widening margin of error.

Yeah exactly, shouldn’t have to rely on that especially if you don’t want any margin of error. It may be worthwhile to not go that route and try to find a scripting solution.