How to run a query and update table data from Javascript

I have a data table and I want to click a button and run a different query "ListErrors" and update the table data with the results of that query.

I have a button and I added the following Run Script Javascript code: = ListErrors.trigger().data

Thanks in advance!

Hi @ScottRichards,

You might need to set it at the actual table Data source setting. If it's a dropdown, click the Fn button to turn it into code, and then perhaps something like ListErrors.trigger().data || so it will fall back to the initial data if the Errors query is empty.

You might have better luck using a second table though and then just setting the initial table to hidden if your second query has data. It could work all in one table with dynamic source data, but I think handling further interactions could get messy.

Agree with @MikeCB , 2 tables will probably be an easier solution unless the queries have identical columns and column types and will have the same actions/formatting etc

Thanks for the suggestions! I figured out how to update the table with results of the query with the following code:


I am just filtering the same data with this query so having a second table would have been duplicative and a pain to maintain separate tables that are displaying the exact same data.