Not Saving Table Changes

I am working with MySql. This topic has been written up for other languages.
When I make changes to my table, a "Save Changes" button appears but when I click on it, the changes are not saved.
Maybe its better that U develop my own button but I can't seem to find an Event Handler for Saving.

When you click on the table and inspect it, do you see the following as an option under Event handlers?
Screen Shot 2022-10-12 at 9.45.18 AM

Scott: My screen does not look exactly like that. I am allowed to add an event called "Saving" but it is using my first query which has nothing to do with Saving. I am happy to write my own code for this but I don't know how to go about it because ReTool is normally saving things on its own.
I am attaching a screen capture for clarification.


I am adding another graphic which is more like what you mentioned. The problem is it is attempting to use one of my queries for saving.

If your columns in the table are editable, you should see a Save Changes button appear in the footer of the table when the cells are changed....
Have you read the docs here?

OR here Writing to SQL

Here is some text in the help file.

Like before, let's update the query name (bulkUpdate ), choose the new query name from the "bulk update action" dropdown, and choose our table (users ). This time we'll select "bulk update via primary key" from the "Action type" dropdown.

I can find no "bulk update action" dropdown. And I can find no choice of "bulk update via primary key" from the "Action type" dropdown.

I am using MySQL, possibly the menus are different for the language I am using.

Hi @mdsmith1! I have a MySQL query that looks like:

Would you mind sharing a screenshot of what you have? :slight_smile:

Victoria: I was not using GUI mode and that probably explains why I could not make sense of the help file.
I have used the GUI mode and have run into an error in that my Table "Test01" does not seem to be defined. See the attached screen shot.

Awesome, glad you found the action type inside of the GUI mode!

Now in your "Array of records to update" field, you'll need to pass in an array of new values, which should be coming from your_table_component_name.recordUpdates.

Currently, you're passing in "Test01" which seems to be the name of your db table.

Victoria, I can't quite figure our what my table component name is. I have found on one screen that my table "test01" is called "table2", so I tried that. And I get an error message "Data must be an array". How do I figure out my table component name? A screen shot is attached.

You’re getting closer! So the table component has a property called ‘recordUpdates’ (capitalization has to be exact) that is an array of objects, where each object is a row from the table component that was edited.

I think if you try

{{ table2.recordUpdates }}

(must be exact) and then at least one edit to your table component (to populate the recordUpdates array with some edited row data), your query should work to bulk update :slightly_smiling_face:

Let me know!

Thank you so much. It works !!

If you can believe it, I had a semicolon after the code and that stopped it from working. It taught me how to read the error notes at the bottom of the screen and possibly I am better for that.

Thank you so much. I am starting to understand how it all works but a big hurdle for me has been the syntax.


So glad to hear it and glad you found the pesky semicolon.

Create new threads anytime, we’re happy to help :blush:

@victoria Is there a way to update another column in the database table? So if a row was updated, it will also update another column, is_updated, from 0 to 1.

Does that make sense?

Hey @Imcnatt! This should be possible. How are you currently writing your update query? That would be great to see a screenshot of!

Ah got it, thank you for sharing that. You should be able to pass in an object of records to update, just with the new column manually added in. In my example, I added in the updated column manually to the recordUpdates property.

Would something like this work for you?

{{ =>Object.assign(obj, {is_updated: 1}))}}

Victoria: I have had this working fine for 3 weeks and now I find that I am unable to transfer data to the server using the {{table2.recordUpdates}} feature.
I have made some changes in the table structure maybe that is a factor.
I have tried to Run the feature and am now getting error messages.
I have attached 2 screen captures.


Hey @mdsmith1! Happy to help here (and sorry for the delay in getting back to you, just getting back from PTO :palm_tree:)

Thank you for sharing those screen captures. Hmm could you try removing the semicolon? Adding a semicolon in that field of one of my working queries throws the same error message.

Thanks Victoria:

That was one of the problems. I also had a period in a blank after what I thought was the end of my code.

When I fixed those 2 things, it worked perfectly.

Thank you for your reply.

I will mark the "Solution" button on this.