When you set up a transaction on a form for multiple table postings, does Anvil have specific code to add a transaction reference, or what is the recommended way to add this?
When we coded the program on our local python console we used rand int, but I dont really want it to be random, I want it to be a sequence, starting from a certain number.
Would welcome suggestions on what others have done. Thanks in advance.
Thanks I will create a counters table and add the code suggested on your AI Field Thread. Its a detailed transaction with several tables to update, so fingers crossed it works
I would say that setting up a transaction on a form for multiple table posting is not a recommended way in itself.
During the time between the start and the end of the transaction, the rows / tables / database (I donât know the granularity) involved in the transaction are blocked and canât be written to. Setting up the transaction on a form means you will have a bunch of roundtrips between the beginning and the end of the transaction, which means the duration of the transaction will be hundreds of times longer than it needs to be.
It can be OK if you can swear that your site is very low traffic, but âsetting up a transaction on a formâ it is not âthe recommended wayâ.
The recommended way is to have the form collect all the data required for the transaction, pack it in a dict, pass that dict to a server function, then execute the transaction on the server.
This way the time required for the transaction will be much shorter.