We have a daily program that gets a lot of data. On one of the data points, we use the queryTagCalculations with the aggregate "LastValue" with a short window time (10 minutes) to simply grab the value at a certain time in the morning. Also, noInterpolation is set to False, so that it interpolates the value, which is needed otherwise many values will come in as zero. This presents a double edged sword with the issue below.
The problem is that we disabled the tag a week ago, and the value correctly shows "Bad_Disabled", but "LastValue" still gets get the last known value before being disabled. We want it to be zero. IgnoringBadQuality parameter doesn't help since "Bad_Disabled" is not a bad quality stamp in the historian.
I would think that if we are using queryTagCalculations (or queryTagHistory), and if we look at the specific time and window, even with interpolation and the value does not exist, we would get zero, but that isn't the case. Technically, we could read the tag quality and if "Bad_Disabled", zero it out, or read the current tag value (readBlocking) since it's a discrete value, changing once per day, but we also want to sometimes run this and go back at any time and know what it was at that time, hence the queryTag function.
Is there a better way to handle this?