Inline Edit Custom Mode with MYSQL batch update

Hi, Appsmith Support team and community,

I am working on the in-house app with MYSQL database, the new inline editing is great and must have feature for our dev requirement. For google sheet or mongo db i see so easy to integration that with batch update/ updateALL but for mysql db, i cannot really find any good documentation how to implement it.

For single row inline edit and update, i get it working with the following,
(* i am using the v1.7.12, the Table2.updatedRow doesn’t seem to be working returning empty fields so i just the updatedRows array to get the data)
UpdateQuery:
UPDATE contact SET
first_name = ‘{{Table2.updatedRows[0].allFields.first_name}}’,
last_name = ‘{{Table2.updatedRows[0].allFields.last_name}}’
WHERE id = {{Table2.updatedRows[0].allFields.id}};

For the custom inline edit with multiple rows, I ran into roadblock, how i can write the JS Query to call the MYSQL update query and dynamically passing the value in update query?

Here is some ideas i have but not sure what’s the best practice and how to implement it correctly, please help!

{{function() {
for(let i = 0; i <= Table2.updatedRows.length; i++) {
//Run the update query and passing the id inside the mysql query?
}
}}}

Hey @ironman850!
Please take a look at this sample app that shows you exactly how you can do this - Appsmith

Fork it and take a look at the mentioned steps.

2 Likes

Thank you Pranav,

The sample app looks very helpful and straightfoward with google sheet integration but i am using MYSQL DB. it doesn’t provide the UpdateALL like the google sheet and I am pretty new to javascript, not sure what is good way to have JS function with foreach or a loop to call mysql update query.
If you have more example on the mysql or similar db approach please let me know, Thank you! Felix

I had the same question – the example shows how to conveniently do this with google sheets but it would be great to have a recipe for doing this with SQL databases.

Hi! Please fork this sample app which demonstrates how to do it in PostgreSQL and let us know if it helps.