What's an acceptable length for reference numbers and what's a good way to generate them?

What’s the best way of creating succinct reference numbers for things like Order IDs that users need to refer to? Is there an accepted length that these things should be so that they do the job and keep Users happy IRL.
When creating my app, to uniquely identify an order, I took the last 6 characters of the UNIX date stamp and appended part of a user’s Username then appended 4 random characters onto that. That got me on my way but the resulting 14 character references are too long because it’s a bit belts and braces. Is there a way to shorten them while ensuring that the references stay unique?

Many thanks in advance

Hi there, @joefarrowsmith… I don’t pretend to be an expert on IDs and their uniqueness, but I will drop a thought on the subject, and maybe it will only serve to bump your question to the top of the stack so someone can point out how stupid I am and then give you a better answer.

If I recall correctly from the last time I looked into it, generating a 6-character ID that only uses uppercase letters, lowercase letters, and 0-9 (which you can easily do with Bubble’s built-in Calculate formula >> Generate random string operator) produces somewhere north of 55 billion combinations. If it was me, I would likely go that route and either check for uniqueness when a new ID is generated or simply not check for it, roll the damn dice, and move on with my life because unless I am creating an insane number of orders per day, I will take the odds that the IDs are unique.

Anyway, it’s just a thought, and I await my lashings from the folks who are somewhere north of 55 billion times smarter than me.


Hi Mike
Many thanks. I’ve been looking into this all morning and concluded the same thing as you…life’s too short for that level of purity. FWIW, my OrderRef now incorporates a different chunk of the UNIX time stamp with other randomly generated characters appended to the end. That should (and I’m no IT, maths, stats or even general expert in anything) give me a good enough unique code.
Just the reassurance from your good self is very valuable here. Thanks ever so much.
Have a lovely day
All the best

1 Like