Dynamic Enable / Disable Perspective Query Binding?

Ran into an issue today that seems like something we should be able to do.

The scenario:
View with a tab strip, that shows different sql query tables for each tab. Above the tab strip are some selectors for start and end times for the queries that get the data shown on the tables.

The problem is in using the named query binding on all the tables, anytime the parameters are changed, the queries for every table run because it was fired by the property change. In this case, the query for the table the user is looking at should refresh, not all of them.

I think it would be nice to be able to dynamically enable / renable the binding in this case, but I understand that might open up lots of problems.

There are some work arounds: using embedded views, a secondary set of props for each table that only gets written to when that tab is loaded, or just not using the query binding and use an expression structure + script , but they all require a lot of work for something that seems like it should be easy to have control over if the query runs or not.

In the tab object for each tab, (as of 8.1.5) you can add a runWhileHidden prop that when false will not allow tabs in the background to run. This should prevent the bindings of hidden tabs from updating.

See this manual entry.
https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Tab+Container

1 Like

If @lrose 's answer doesn’t apply, then you will simply not be able to use bindings that way. (Bindings cannot be enabled/disabled.) You will either need to script the bindings themselves, exiting early when not applicable, or create extra source properties for the bindings to reference. Copy from the real source properties to the ones used by the bindings via change script.

well this looks exactly what im looking for, thanks!