Update DB from the table component

I have a reTool DB called customer_tickets. fields: id, userid, status, complain, comment
I've created a reTool app that fetch the rows from that DB and display them.
I want my team to use that app and have the ability to update the status and comment for those rows.
I've tried all kind of ideas that were posted here. Can someone recommend on a session that I should follow that worked?
Thank you all

Have you made the columns editable in the table and then using Bulk Update (GUI mode), update the DB?

Thanks @ScottR . The relevant columns are editable. I added an Add-On to the table of type "Save actions". I have an update sql of the data. It runs when I update it and I also get a response that script ran successfully but the data is not really saved and also the row in the table is not updated.
This is my update SQL code:

UPDATE customer_ticketsDB
SET status = {{cs.selectedRow.status}}, comment = {{csTable.selectedRow.comment}}
WHERE id = {{csTable.selectedRow.id}}

Checkout this article in Docs... Write data to SQL databases | Retool Docs

Thanks @ScottR
I followed it and I get this error:
"Empty .update() call detected! Update data does not contain any values to update. This will result in a faulty query. Table: customer_ticketDB. Columns: ."
Any idea?

In addition, I don't fully understand the "Filter By" section. Is that should be the fields which are editable? the primary key of the DB?

You can use Bulk Update in GUI: (writer_id is the primary key in the db for me)

set the primary key in table component as the same in the db and in the query

Screenshot 2024-01-17 at 4.40.51 PM

and also in the table component: (Save Actions - add the query)

Screenshot 2024-01-17 at 4.36.40 PM

1 Like

It worked! I was missing the "Array of records to update"
Thank you so much :pray:

2 Likes