queryTagCalculations - Bad_Disabled tag is still getting last known value

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?

Hi rpavlicek,
Could you clarify what is the version of Ignition that you are using and what component that you want to display the data of the tag on? What do you want to achieve on the last value of the tag when it is disabled? The "Last published value" should represent the last value on the tag when the diagnostics tab was last updated.

We are on version 8.1.26. This isn't on a component, but for a report or gathering data for something else. I can see how it would be working as designed to get the last know good value, but it would be nice to have an option in the queryTagCalculations to show a zero for a bad_disabled tag. Our reports show recent data, and we enable/disable tags depending on if an instance of a UDT is disabled or not.

Hi rpavlicek,

Would you please share the script you are using to populate the data?

You could use a custom history aggregate and return 0 on a quality failure.