I would create a new field in the User data-type called UserID and create my desired naming convention in that field.
Then create some logic which runs when the user signs-up which does something like: (UserID = User.UserID.LastItem + 1)
By the way - I came up with a solution to the design layout problem you had. I left a comment for you on that thread.
Wouldn’t it be possible to end up with duplicate IDs if two items are created at the front end very closely in time? This is the timeline:
Let’s say last item is 24
User 1 starts save and workflow 1 requests last item: gets 24
User 2 does the same and workflow 2 also gets last item number: 24
User 1 stores record using number 25
User 2 also stores record using number 25
Unless workflow data operations are atomic?
This is why this problem tends to be solved at the database level. Other such systems like Knack and force.com have auto-increment fields.
Having a setting on database fields that required unique values would be a good start, because at least you would then get an error on the second user submitting. I will submit that as an idea.
That is why I want it set on another variable which is inputted by the user them self making the “Id” sequence unique to that user.
The unique id can be something as simple as their nickname plus a 1 at the end (nickname1) and each time user creates a Thing, the system uses their nickname (or username, email, other input…) and merely ads a 1,2,3,4 and so on for each entry they make to the database.
This would alleviate the problem you refer too as it would be impossible for any other user to claim that record in the dB as its tied to them specifically.
I just don’t understand where I can configure this or if it’s even possible @emmanuel. ?
“Then create some logic which runs when the user signs-up which does something like: (UserID = User.UserID.LastItem + 1)”
Where am I supposed to inject a formula like this? I’ve never seen a formula/setup like this anywhere in Bubble yet…
Secondly, @emmanuel you state to create a unique ID which I’ve done (‘Airpool Flight Number’ under ‘flights’) and at the workflow level i’m looking at the below screen:
Where am I supposed to be filling in a formula that uses another user inputted variable/thing and simply ADDS a # to it effectively making a unique ‘record’ as a Flight Number. ???
@JustinC have you managed to solve this problem? Similar to you I want to show users the unique ID of products they enter in a database and allow them to find the products using the ID. However the unique IDs from bubble are way to long to be usable.
I found this open source hashing function that allows to shorten large strings into unique IDs. Was thinking of using that through an API to shorten the bubble unique ID, however haven’t succeeded yet in implementing it. Still new… http://hashids.org/