July 24, 200124 yr Newbies I've been given the job to create 30,000+ usernames for our School System (teachers and Students). I've downloaded their id numbers, surnames and firstnames. We want to create a unique username, using the surname(first 6 chars) and firstname(first 3 chars). However, I have many duplications. Is there a script available that can assign a number to the duplications (eg)smithjoh1,smithjoh2,smithjoh3...etc)Thanks.....
July 24, 200124 yr create a text field with the option AutoEnter, serial value checked. then create a calculation field that adds the first six characters of surname, the first three of the first name, and the autoenter serial value. or, if for some reason the length is an issue, add some steps to the calculation to check if the username is unique first, and if it is, it adds nothing. If it isn't unique, it adds one to a counter field in a separate file then adds the new number to the end of the username. then you would only increase the number to add to the username with duplicates, whereas the first example just increases with every student whether they are duplicates or not. you could shorter it even further and have it always add a one to a duplicate username, and if that still isn't unique, make it a two, and if that isn't unique, make it a three, etc etc. then you would have brownrob, brownrob1, brownrob2, greenfre, greenfre1, etc. hope that helped.
July 25, 200124 yr Create the fields: prename (text) lastname(text) id (text) g_counter (global number) make a self relation on the field id the script that will fill out the unique id will be: Exit Record/Request Set Field [id, Left(prename, 3) & Left(lastname, 6)] Set Field [g_counter, 0] Loop Exit Loop If [Count(relation::id) = 1] Set Field [g_counter, g_counter + 1] Set Field [id, Left(prename, 3) & Left(lastname, 6) & g_counter] End Loop Have Fun Gerd
Create an account or sign in to comment