I am creating a purchase order app for my company. I created a SQL table to hold all the purchase order numbers to be used in sequence so it will auto assign the PO number. When the user clicks on the gallery for the next number, I run code to update the table with a flag that it is locked and cannot be used by another and filter my gallery based on that flag.
Issue I am running into is when there are multiple users going in the flag does not always get caught in time and each user will use the same number.
Anyone have a way to assign the numbers properly while having multiple users in the app creating purchase orders?