addRow.changeset.update Error

I am having a problem with one of my apps. I have an update query I made using GUI Mode. One of the fields I need to update is "completed_date" and it should get the value from "completed_date_control.value". This is shown correctly in the Changeset Key value pairs, and the value text {{completed_date_control.value}} is in green indicating it is correct. When I test the query by clicking Preview, it shows in the Console that it ran successfully. However, when I make a change to any control and click the "Save Changes" button, the query fails with an error message "Error: Can't find variable: new data from addRow.changeset update(arrow)..." The name "mynewdata" is what I had previously named the date control. Nowhere in the app can I find any reference to this name yet it somehow keeps coming up. I've tried renaming the control again, I've tried replacing it etc and yet it still comes up as an error (and the update fails). This appears to be the only field/control with this issue. I checked the postgres db (hosted by retool) to make sure there wasn't something strange about that field but it is identical to others that are working fine. Any ideas? Any way to search the code behind all of this to find the culprit? Thank you for your ideas!

hello, welcome to community. Could you share some screenshot? thanks.

I found and fixed the problem. In turns out the problem had nothing to do with what the error message suggested but rather I had in my select query several joined tables. The tables all had an id field named "id". since I had selected all fields using asterisks like this: "SELECT a., b., c.*..." it only kept the last id field in the output. Thus when the update query fired it had the wrong id - the idea that it got did not exist in the table that was targeted for the update.

The solution was to explicitly list the desired fields using aliases like this "SELECT as aid, as bid, as cid..."

1 Like