Load and overwrite data to table from different sources based on the button clicked

Hi all! I have a table and would like to load data from different data sources based on the button that is clicked. Button1 executes a query, Button2 uploads a CSV file.
I'm wondering if there is a way that I can show the data from whichever source was last clicked.

For example, if I click Button1, the table will load the data from the query I defined. Then if I click Button2 and upload the CSV file, the table should be completely overwritten with the new data from the file upload. I can only seem to do one or the other. Any help would be greatly appreciated! Thanks!!

Hello, you can have a variable to track which buttons was clicked and set the data source like

{{ variable1.value === 1 ? query1.data : variable1.value === 2 ? query2.data : query3.data }}

if variable1.value is equal 1 use query1 data, else if variable1.value is equal 2 use query2 data, else use query3 data

or a transformer:

const x = (() => {
  switch ({{ variable1.value }}) {
    case 1:
      return {{ query1.data }};
    case 2:
      return {{ query2.data }};
      return {{ query3.data }};

return x

and use the transformer as the data source