How might one dynamically select the Named Query to be used on a Power Table?

I have a powertable with a named query data source. I would like to use some radio buttons to select which named query is being used in the powertable. Can’t seem to find scripts for setting the data source binding property.

I suppose I could just make several tables that are bound to the correct named queries and have the radio buttons toggle their visibility… but that seems so inelegant.

I think there are a couple of options. First, you mentioned making several tables - no need to do that, you could make a couple of dataset custom properties on the same table and in the binding to the real data property, you could decide which to show.

Another option is to make a custom script on the power table that will take an input (which named query to run) then run that named query in the script and return the results. So if you named the custom function ‘runChosenQuery(qryName)’ in the power table, the binding would be

runScript('self.runChosenQuery', 0, {point to the right property here})

That will re-run the script every time the property you use is changed.


I like this, Mike. Made up a sample project to illustrate. It also lets me wrap my brain around concepts.

DynamicNamedQueries_2019-02-22_1347_partial.proj (10.5 KB)