How do I write a simple code (webhook, I think) in order to create an auto numbering in a column of a collection? I want each record to have number that automatically numbers that record with the next number.
+1 for me too
This question has come up before and was, from memory, answered by Yoav (one of the Wix Code developers). Search for “auto-increment” or combinations thereof. But in short: it´s not available. You can try to develop it yourself, and in a low volume environment it might work, but basically, there is no way to guarantee that two concurrent request do not get the same number (which is not good), no matter where you put it, while generating the data at the front end or with a db-hook.
If you envision a high-volume environment, better look for a development environment that supports auto-increment natively or at least a WAIT_LOCK on a row. Wix Code is good, but it´s a hammer, while not every problem is a nail.
I agree with Wayne, in a low volume environment it might work.
An alternative is to use a random number generator together with other unique identifier (e.g. customer id) to derive a unique order number.
I need help here too, PLEASE