Auto Increment

The method shown in my tutorial is also subject to concurrency/race conditions, so is probably not suitable in this case.

@Matthew_Saragusa the only way to be 100% certain of avoiding collisions is to delegate the allocation of your order numbers to an external 3rd party. The problem with doing this in Glide is that all calculations happen client side, so it’s always possible for 2 or more clients to come up with the same number independent of each other.

Your API idea should work - as long as the API is maintaining an independent counter. If it’s using anything that comes from the client to generate the number, then you have the same problem.

What I would do in this case is use Make (Integromat). When a new order is created, trigger a webhook from Glide with just the generated RowID as a parameter. Make would then pop the next available order number from the stack (which could be just a simple increment), and then set the order number to the correct RowID via the Glide API. There would be a slight delay with this method before the order number appears, but no more than about 5 seconds.

2 Likes