Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unique LabelNumber

Guest
Jun 17, 2008 Jun 17, 2008
I want to create a unique 6 character ID with numbers and letters. Without using the letters 'B', 'D', 'I', 'S' or 'O'.

I got this far but how can i mix the numbers and letters randomly to get the label. I'm stuck. Thanx.
TOPICS
Advanced techniques
329
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 17, 2008 Jun 17, 2008
I would make this a function

goodchars = "0,1,2, etc ,A,C, etc";
lengthoflist = listlen(goodchars);
id = "";

for (i = 1; i gte 6; i = i + 1) {
id = listappend(id, listgetat(goodchars, randrange(1, lengthoflist);
}

<cfreturn id>

Then you test to see if the id has been used before, and keep calling it until you have a unique one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 17, 2008 Jun 17, 2008
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources