So if I understand you correctly, you use the all users count +1.
That could work, but what if a user deletes their account? Then someone can technically grab that same number, it may even start a chain reaction of duplicate numbers if a user deletes.
I use this formula when the user registers to assign them an ID:
Current time is already a unique value as it changes every second, by you could have the case that two or more users click on register on the exact second. That’s why I added the random function between 1 and 1,000. That significantly reduces the probability that two users will have the same ID.
When user delete user record, maybe update all the information of the user to "deleted user’, but not removing the record. So, the userID by count may still work.
Deleting the record altogether will require deletion of all related records in other collections(tables).
One may devise a function/formula to get a unique ID, but I just find it even more complicated.
Just my 2 cents. Cheers.
If someone prefers to use incrementing IDs, please keep in mind, that you need to use ID → Maximum +1 as a new ID, not Count.
Example reason not to use count: you create 10 users, 11th one will get ID=11. You delete 5 users, 6 are left. The 12th one will get ID=7.
The “funny” part in all this topic is that Adalo already has unique IDs for every record in every collection. For some reason this information isn’t available in the app builder (however it is easily accessible via API). So we are kind of reinventing the wheel here.
It has been requested several times to make these IDs publicly available. I did this as well, please feel free to upvote: Make unique record IDs publicly available | Voters | Adalo
Well, if you add +1 to Maximum - how will it return duplicate result?
I’m not talking about “race” conditions, when 2 users are added at the very same moment of time. Usually this is quite rare case in most of scenarios.
Great that you’ve chosen the solution which suits your needs best!
It’s not a count, it is maximum.
E.g. you have a collection with ID property, ID is numeric.
You add a record and set ID to 999.
You add another record and set ID to 1.
When you use “Count”, you’ll get the value of 2.
When you use “Maximum”, you’ll get the value of 999.
If every time you add a new record, you put ID as Collection → ID → Maximum +1, then you will always have a higher value in a new record.
It works with all collections, not just Users.
There is a slim chance that 2 app users will add records to the collection at the same time. With this you may end with two similar IDs. But again, the chance is quite low.
I’d say that personally I’d go with unique ID generated based on 2 large random numbers
Sorry, not allowed for my application. I can only have alphabetical and numerical characters for what I use the ID for. Adding the date and time field includes things like colons.