When a Tag used as Named Query parameter changes, data is reloaded, but not always properly

Another named query question from me.

Here’s the query I’m talking about:

DECLARE @downtimeDivisor AS INT = 1

IF :downtimeFormat = 'hours'
	SET @downtimeDivisor = 3600;
ELSE IF :downtimeFormat = 'minutes'
	SET @downtimeDivisor = 60;

SELECT TOP(:limit)
	stops.first_fault 	AS fault,
	COUNT(*) 			AS count,
	(SUM(stops.stop_duration) / @downtimeDivisor) AS downtime
FROM stop_history stops
WHERE 	stops.first_fault_time BETWEEN :startDate AND :endDate
		AND stops.first_fault NOT IN {hiddenFaults}
GROUP BY stops.first_fault

My situation is this:

  1. A view is showing an XY chart whose data are from this Named Query.
  2. The downtimeFormat parameter of this Named Query comes from a tag whose value can be changed via a dropdown in another view that is a popup.
  3. If I change this dropdown from hours to minutes or seconds, the XY chart updates properly.
  4. If I change the dropdown from its current value to one that gives a smaller number (that is, from seconds to minutes, seconds to hours, minutes to hours) the XY chart does not update properly. The data refreshes, but it shows the values related to the previous dropdown selection. The XY chart’s Y-axis is also based on this downtimeFormat tag, and they are properly updating.

This behavior is inconsistent. Sometimes the data updates as expected, sometimes it doesn’t.

I have tried everything related to disabling caching, but I cant seem to find a way to forcibly refresh this property’s Query binding from the tag changed event, or from the dropdown change since it’s in another view.

Is there something I’m missing? I’m really not sure what is going wrong and how to get this chart data to update properly.

EDIT: Just tested to be sure, and the same behavior happens no matter if the dropdown is in the same view as the XY chart or in a different one.

Another observation on this, if I set the dropdown to seconds, then hours, then seconds again, the seconds data is always shown, but when changing from hours to seconds the proper hours data flashes quickly on the table before being replaced by the seconds data.

Really not sure why this is happening, it seems like the table isn’t refreshing properly or something. Could be a bug?

Another update here, not sure if this is related.

I have a chart that’s controlled in exactly the same way as the first, but the first has Column series and this one has Line series. Whenever I change from hours to minutes or similarly from any setting to one that results in higher values, my line chart gets “tangled”. However, if I reload the page completely, the linechart looks fine. I’m sorting the values in my query specifically so this won’t happen.

Again, been doing more testing.

Eliminating @downtimeDivisor and changing it into a query parameter and assigning it using a custom property (which in turn is Map Transformed from the tag selected in the dropdown) doesn’t fix anything.

So after some more testing.

This is being done in a VM, and the VM is kinda slow, but I noticed when running the Perspective view in my Host OS’s browser, the problem doesn’t happen. Similarly, when the VM isn’t under much load, it doesn’t happen. All my testing was done with Designer running and a Chrome browser window showing the project too.

So it seems to have to do with performance, somehow.