What is the mySQL syntax of the following GUI action

  1. I am making the following bulk update via primary key using the GUI
  2. What is the mySQL syntax if I am passing an array of records to be updated?
  3. I with to use the mySQL syntax than the GUI because I need to update multiple tables in one query. While the GUI limits update to once table per query and I do not wish to have multiple queries for a similar action.

Thanks.

Hey Oliver!

Happy to help here! If you are looking to build queries in SQL mode you can toggle this in the query builder in the dropdown here:

To pass this array of records to update I would set up a JS query to iterate over the records updates, passing the data for each row to update to a query.trigger() via additionalScope as in this example from our docs.
Next we would need to set up a query to update multiple tables for each record individually. Any data passed into this query from the JS query can be referenced by the key we pass to it. So in the example from the docs you could reference data being passed down here using {{data}}.

This would look something like this:



Lastly, I'm not much of a SQL expert but if you are really intent on squeezing multiple table updates on multiple rows into a single SQL query, you may be able to do something like the image below. In the image, the query is updating multiple columns on multiple tables based on a unique index value. You could write some javascript in the SQL editor in {{}} to generate this type of query and likely consolidate everything into a single query.


I'm not sure if it would be worth the effort though if you are only processing a fixed number of user edited rows from a UI table.

Please let me know what you think and if you have any further questions!

Thanks!
Grace