Refresh a table data after trigger

Hi all,

I am trying to make sure the data of a table stays updated once a record is inserted to the underlying object from the table.
I created a simple "insert" row into table button, and a display table that shows the rows created by that button, but every time I create a new entry, I need to click on the refresh button on the lower right corenr of the table to see my newly created record.

Is there a way to trigger this automatically?

Hi @Johan, you can run the read query you use to populate that table. On the bottom of your BQ query inserting row resource, you can see the event handlers. Add your readBqQuery on Success. This way, you can see the table reloading with your new insert. Note that the reload button on the table also runs your query resource to populate.

Hi @Johan, can you please show the queries you use to add a new row? I'm receiving this error "Unable to perform operation using terminated connection." and it shows a message that says that no row was created

Hi @maalexandrat05, welcome :wave:
Have you tested your resource connection to BigQuery? The error message means that your connection from Retool to BigQuery was terminated so you can't do any basic operation. Do you have the right scope for your credentials?

@jocen Hi, I already solved that part, it showed me that I needed to fill some columns because they were not nullable, is there a way to change that? Because sometimes we don't need to fill the ID number

I'm also having an issue with edit row, chatted with support and they told me this:

You are currently Filtering and updating different objects. For the Filter by you should only need ID = {{listrow.recordUpdates[0].ID}}

If you are updating from the same table you should be able to just make the changeSet the {{listRows.recordUpdates}} object.

I tried with that but it shows me an error on Filter by, it says: "Cannot read properties of undefined (reading 'ID')"

Hey @maalalexandrat05!

Happy to help with this. That error seems to indicate that listrow.recordUpdates[0] doesn’t contain an ID key.

If you make updates to your table (to populate the recordUpdates data) then open up the State tab in your left panel, could you open up listrow and then open up recordUpdates and then open up one of the objects inside?

Hi @victoria. I opened the State tab but on listRows, under data, I found recordUpdates and it says this:

recordUpdates [ ] 0 items

Ah, so that means there's nothing in there! Which means we haven't actually made any updates to the table yet. Once you edit a value on the table, it should populate with values. Can you try editing a value on the table? :slight_smile:

@victoria @victoria I've been trying to edit the rows but when I update it I'm getting this error: update "table name" set "0" = {"id":21,"brand_code":"GNBC","BRAND":"","AMAZON_BRAND":"Carroll Shelby","AMAZON_MANUFACTURER":"","AMAZON_CATEGORY_FILTER":"","AMAZON_BRAND_APPROVAL_STATUS":null,"AMAZON_BRAND_APPROVAL_REQUIRED":null,"DATABASE_NAME":"statistic","INGESTED_AT":1673820297513,"_LOADED_AT":1673823671482,"MARKED_DELETED":false,"SOURCE_MODIFIED_AT":null} where "ID" = 21 - SQL compilation error: Unsupported data type 'VARIANT'.

Ah, apologies, I meant just an edit to the table component! This is how we can populate the table1.recordUpdates property.

"After making columns editable, you can double click on a cell to edit it. When you edit cells, changes are saved in the table's recordUpdates property. This tracks the changes you've made but it doesn't update the underlying data source that your query connects to."

https://docs.retool.com/docs/data-in-tables#editable-table-columns

@victoria Ohh okay, you mean without saving, yes I can see the objects inside. It says:

recordUpdates 1 item
0 {} 14 keys
In here are the columns

Ah cool! Hmm that "Unsupported data type 'VARIANT'" error usually seems to pop up with columns that are arrays. I'd also be happy to hop into your app to take a look. If that works for you, please feel free to DM me a link to your app! If not, no worries at all.