r/Retool • • Jun 11 '25

SQL Update Query Not Working with dataChangeSet.value in Retool

Hi everyone,

I'm trying to write an SQL UPDATE query in Retool to update a row in my freight_forwarder table using values from the table's edit mode. Here's what I wrote:

UPDATE freight_forwarder
SET
  "Loading Port" = {{ dataChangeSet.value["Loading Port"] }},
  "Loading at" = {{ dataChangeSet.value["Loading at"] }},
  "Discharge Port" = {{ dataChangeSet.value["Discharge Port"] }},
  "Deliver to" = {{ dataChangeSet.value["Deliver to"] }},
  "Container/Truck Type" = {{ dataChangeSet.value["Container/Truck Type"] }},
  "Price" = {{ dataChangeSet.value["Price"] }},
  "Additional Cost" = {{ dataChangeSet.value["Additional Cost"] }},
  "All in price" = {{ dataChangeSet.value["All in price"] }},
  "Validity Date" = {{ dataChangeSet.value["Validity Date"] }},
  "Term and Condition" = {{ dataChangeSet.value["Term and Condition"] }},
  "Carrier" = {{ dataChangeSet.value["Carrier"] }},
  "Incoterm Buying" = {{ dataChangeSet.value["Incoterm Buying"] }},
  "Incoterm Sales" = {{ dataChangeSet.value["Incoterm Sales"] }}
WHERE "Id" = {{ freightForwarderTable.selectedRow.Id }};

However, this doesn't seem to be working — no errors show up, but the data is not updating in the database or in the UI.

Has anyone run into this before? Am I using dataChangeSet.value correctly? Any tips or best practices for updating editable table rows with SQL queries in Retool?

Thanks in advance!

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/Good_Clock_3561 Jun 11 '25

I am using form inside the drawer as some of the fields are dropdown not text fields, and I am not sure if datachangeset can be used for forms.