Is there away to populate a field with a unique number i.e order number/Contract Number?
Yes! First, make sure you collection has a number property.
Then, you can have an action to create a new item in the collection. For the number property in that action, you can set the value to be “{Collection>Count} + 1”
Hi Ben,
Is the same process if I want to create user ID for newly registered user?
Yep, that’s right; it is!
Hi @Ben … following on this topic…I was trying to implement an automatic order number generator and this method works just fine, but what if I want to delete/cancel an order? lets say I delete/cancel order 98 out of a 100 already made and I’d like to continue the same sequence… this method would duplicate order number 100 once I try to create order “101”. Is there a way to find the Max value of a field in my database? in this case the Order ID field. This way we could implement a Max+1 logic right?
Hi @pacorro,
I think you can get “Maximum” for a property of Numeric type in a collection.
From other point, I prefer not to delete records like orders in the collection, but rather mark them “cancelled”, “abandoned”, etc.
Best,
Victor
Thank you @Victor…I just found this topic with the solution (Auto generate a UserID when a user signs up to my app)…I was thinking about deleting records to save space in case I have images, videos and such in said records.