Generating User Names
Posted: Thu Dec 16, 2010 3:42 pm
OK, since I got such an awesome answer on my last question, I figure maybe it wouldn't hurt to ask this one. And I promise, I will contribute here once my level of knowledge has gotten up higher!
I work for a school district with 70,000 students. I do district server level stuff, and I've already got old rev scripts working behind the scenes to do lots of different things. But here's something I'm struggling with.
We're trying to generate unique user names for our students, based on a combination of names, parts of their student ID number, and parts of their birthdate. We can't use the whole student ID number OR birthdate because we're not allowed. So I'm trying different things.
I wrote a script that puts all 70k names, birthdates, and id numbers into a variable (one student per line,) then uses a repeat loop to go line by line through the variable and determine how many dupes there are. To overly simplify, it's this concept:
repeat with i = 1 to 70000
if listOfUsers contains userName then
put return & userName after theDuplicates
else
put return & userName after listOfUsers
end if
end repeat
This works totally fine, but takes a while to run. Is there a faster way to do this?
I work for a school district with 70,000 students. I do district server level stuff, and I've already got old rev scripts working behind the scenes to do lots of different things. But here's something I'm struggling with.
We're trying to generate unique user names for our students, based on a combination of names, parts of their student ID number, and parts of their birthdate. We can't use the whole student ID number OR birthdate because we're not allowed. So I'm trying different things.
I wrote a script that puts all 70k names, birthdates, and id numbers into a variable (one student per line,) then uses a repeat loop to go line by line through the variable and determine how many dupes there are. To overly simplify, it's this concept:
repeat with i = 1 to 70000
if listOfUsers contains userName then
put return & userName after theDuplicates
else
put return & userName after listOfUsers
end if
end repeat
This works totally fine, but takes a while to run. Is there a faster way to do this?