queryTagHistory - way to return quality?

I'm using system.tag.queryTagHistory with a 15 minute interval to produce a report that shows the historical value of a tag every 15 minutes for 6 months. We need to show 1, 0, and bad (no comms, etc.) Is it possible to return the quality in a column as well? I tried adding the 'PctBad', but this doesn't corelate with times there were known bad values.
If I try adjusting arguments like noInterpolation, ignoreBadQuality, etc., but the closest I can get is producing the report where the data points where it was bad will not show up on the report. I could script it to fill in the missing timestamps and values with 'bad', but was hoping there would be an easier way.

The quality should already be attached to the values in the dataset. You just ask for the quality at a given row:column (literally, getQualityAt(row, col) instead of getValueAt(row, col)) to retrieve the underlying quality.

1 Like

Thanks. I'm surprised this isn't documented elsewhere, especially the working with Datasets article in the manual. In fact, there are only several hits on the forum including this one.

Also, does interpolated values not get quality other than Good? For example, I know where the values should be missing because of comms being down, but the quality during those times I can only grab if I interpolate the results to produce a consistent report with no gaps in the timestamps, but all values have a quality of Good.

I think interpolation is always a flat good quality, yeah. A case could be made that it should be some subcode, e.g. Good_Interpolated or something, but that may not be possible to change at this point.

So i ended up turning off interpolation and making a script that filled in the missing timestamp (the interval minutes specified) with a while loop and appending "Bad" to the row.