Peter Knowles Posted December 19, 2007 Posted December 19, 2007 I'm trying to create a unique user field that is a combination of a user's first name, their last initial, and a number. To guarantee that every user's name is unique I need to make sure that each new user with the same first name/last initial as an existing one gets a new number appended to the end. For example, in the case of a new user with the first name Joe and last name Smith, the initial combination of first name / last initial would yield JoeS. Since he's the first JoeS in the system, the number field would add the number 1 to the end, resulting in JoeS1 as a unique username. When the next Joe Smith (or Joe Stevenson, or Joe S-anything) enters, the number field would add the number 2 to the end, creating a user JoeS2, and so on. I have everything working except for the number at the end, and am not sure if I need to have a script to compare existing firstname&lastinitial fields to determine whether or not the combination is unique, then, if not, sort by number to determine the next number in sequence to add (creating JoeS3, and 4, and 47, etc.) OR if there's a smarter, quicker way to achieve the same result (perhaps a calculation field I haven't sorted out yet) Anyway it happens, I do want to make sure that the resulting field is in the format firstname lastinitial number. I might have taken the wrong direction to get there, and if so, please let me know. Any help is much appreciated.
Digital Life Posted December 20, 2007 Posted December 20, 2007 If you actually have a field 'JoeS' then you could find by it as part of the script of adding the new user. If none are found then place a 1 after the JoeS part. If 9 are found then put a 10 after the 'JoeS' part.
Recommended Posts
This topic is 6181 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now