How to create a database transaction

Gentlemen:

I have a question about creating a database transaction using Xano. I have two tables, Basket and Orders. I need to copy records from Basket to Orders according to user_id (and other parameters). I have created the steps to do this and it works.

However, i need to convert these actions into a database transaction in such a way that if the record copying process onto the Orders table fails for whatever reason, the transaction is reverted. How can I accomplish this?

Than you for your help

Hey @wolves_manse - we have a function for Database Transactions: Function Stack > Database Requests > Database Transaction. Use this and just nest everything inside of it.

Thanks very much fir your help

1 Like