Running an insert query from a button

Question from @edmartin :slight_smile:


I was hoping to ask your thoughts on a process I am trying to refactor. My current order form has two main tables to which it writes data in MySQL; orderHeader and orderDetail. The first is the Customer contact and billing data, the second is the table that lists all of the products being sold and their pricing and other delivery data.

In my first app, I had the user select the customer and then the customer data was queried into a table and represented onscreen by a linked form. There is a component that is linked to a query that retrieves the next is number from the orderHeader table because this is the foreign ket to the orderDetail table.

While the orderHead form is open, the form that allows the user to select products and insert them into the orderDetail table in MySQL is used to "build" the order. My issue is with the fact thay I can run an insert query from the retool page, but if I call the insert query from a button it will not execute.

Hey Ed! Snagged this question from your post in another thread.

To clarify, your button that runs the insert query isn't working? Would you mind sharing a screenshot of the insert query that the button is running as well as a screenshot of the functional insert query?