New topic: Need to create a unique id
<http://forums.realsoftware.com/viewtopic.php?t=29655> Page 1 of 1 [ 8 posts ] Previous topic | Next topic Author Message shaggymac Post subject: Need to create a unique idPosted: Thu Aug 20, 2009 11:08 am Joined: Fri Feb 29, 2008 5:25 pm Posts: 372 I need to create a Unique ID. A person enters his name into some TextFields (2 fields.one for first name the other for last name) and the result should produce some code that will always be the same for the same name Example First Last may produce 1SF2-12FD-9AS2 now ever time that Mr. Last enters his Name as "First Last", the application produces the same code If Mr. Last changed his name to First Last Sr then a new code would change. _________________ http://www.oneoranephone.com Free calls to USA & Canada Free calls to Europe or Asia Free calls to Puerto Rico Plans starting at $14.95 http://www.mupromo.com/?ref=4850 Today's MacUpdate Promo, 40% off Top mrebar Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 11:38 am Joined: Wed Feb 15, 2006 1:30 pm Posts: 2877 Location: U.S.A (often), Creswell, often Dallas, Atlanta, Spokane, Pago Pago. Do you need to display the unique ID? Would something simple, such as EncodeBase64 suffice? Michael _________________ RB 2009r2, OS 10.5.6, Win XP SP 3 Top shaggymac Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 12:07 pm Joined: Fri Feb 29, 2008 5:25 pm Posts: 372 the id is not a serial number or a way of preventing piracy. basically i am writing a data collector app a person types in data in a form. instead of displaying his name. I want to display a unique id (alpha numerical or all numerical is okay) I would prefer a way if I can go backwards example someone gives me his id and I can get his name _________________ http://www.oneoranephone.com Free calls to USA & Canada Free calls to Europe or Asia Free calls to Puerto Rico Plans starting at $14.95 http://www.mupromo.com/?ref=4850 Today's MacUpdate Promo, 40% off Top shaggymac Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 12:23 pm Joined: Fri Feb 29, 2008 5:25 pm Posts: 372 Base64 is a good start I wish there was a way to not have capital/lowercase letters with symbols but thanks _________________ http://www.oneoranephone.com Free calls to USA & Canada Free calls to Europe or Asia Free calls to Puerto Rico Plans starting at $14.95 http://www.mupromo.com/?ref=4850 Today's MacUpdate Promo, 40% off Top simonjohn Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 1:09 pm Joined: Sat Apr 19, 2008 12:44 pm Posts: 185 Location: Dorset, UK What happens when you have 2 or more John Smiths? I can't see how you could create a unique ID from a name. How about a database table with an integer primary key ? _________________ Simon Larkin QiSQL Database Solutions http://www.qisql.com Top shaggymac Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 2:01 pm Joined: Fri Feb 29, 2008 5:25 pm Posts: 372 Well I am using these fields FirstName LastName Email Telephone so it's unlikely that both John Smiths share all 4 peices of data Encoding to Base 64 and decoding it back works. I wish there was a way to make it look like XXXX-XXXX-XXXX-XXXX instead of randomly appearing numbers and letters with symbols _________________ http://www.oneoranephone.com Free calls to USA & Canada Free calls to Europe or Asia Free calls to Puerto Rico Plans starting at $14.95 http://www.mupromo.com/?ref=4850 Today's MacUpdate Promo, 40% off Top computerfreaker Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 2:26 pm Joined: Thu Mar 05, 2009 1:03 pm Posts: 1397 Location: USA shaggymac wrote:I wish there was a way to make it look like XXXX-XXXX-XXXX-XXXX instead of randomly appearing numbers and letters with symbols Try an EditField's (TextField or TextArea in 2009r3) Mask property... _________________ With great power comes great responsibility. Learn something new every day, and the rest will take care of itself. Life is a journey, not a destination. Enjoy the trip! Top gisborne Post subject: Re: Need to create a unique idPosted: Thu Aug 20, 2009 2:39 pm Joined: Tue Feb 06, 2007 11:34 pm Posts: 91 Location: Austin, TX 1. Encrypt the name + phone + whatever 2. Pick some character set you want to use to display 3. Convert to the base which is the number of characters you picked in 2. So if you picked uppercase + digits, you convert the encrypted value to base 36. This is easily reversible, and you can get whatever character set you want. _________________ Read my book, Real OOP with REALbasic Guyren G Howe Relevant Logic LLC guyren-at-relevantlogic.com ~ http://relevantlogic.com REALbasic, PHP, Ruby/Rails, Python programming PostgreSQL, MySQL database design and consulting Technical writing and training Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 8 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
