[FX.php List] User exists - offer other names
Erik Andreas Cayré
erik at cayre.dk
Wed Aug 22 06:17:11 MDT 2007
Den 22/08/2007 kl. 11.07 skrev William Downs:
> Hi guys,
>
> I'm looking for something here and have no idea where to start !
>
> I am building a DB where a user can enter themselves - contact data
> and user name.
> I am looking for a way to say "This user name is already taken. Please
> enter another name"
>
> This I can do - what I CANNOT do is offer them a selection of names (5
> possibilities) that also do not exist !
>
> Example entered:
> User name = wills
> Returns:
> This user name is already taken. Please enter another name. Possible
> examples are
> wills100
> wills200
> wills300
> wills101
> wills202
> Or enter an entirely new name.
>
> Of course, none of the above 5 names exist either.
>
> Any ideas ?
Hi William,
This is similar to generating several unique random numbers.
My solution to this problem is not elegant, but it works:
1. create some alternatives (eg. 5) using whichever mechanism you like
2. locate and delete any dupes
3. if you have the requires number of unique objects (in this case
usernames), you're done, else go to 1.
This is a silly algorithm but it works. It will need to iterate just
a few times (if you use a flexible mechanism to generate candidate
usernames).
I would probably first try this as a script in Filemaker, because
this is where you have the existing usernames to match the candidates
against.
I would probably use a Text field with global storage to contain the
candidates. This field would be related to the uername field and you
could simply check for dupes with Count([relation::username])
Just ask if you need help implementing some of the above;-)
reagards
---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
DK-6705 Esbjerg Ø
Home Tel: +45 75150512
Mobile: +45 40161183
»Interest can produce learning on a scale compared to fear as a
nuclear explosion to a firecracker.«
--Stanley Kubrick
»If you can't explain it simply, you don't understand it well enough.«
-- Albert Einstein
»If you don't have time to do it right, when will you have time to do
it over?«
-- John Wooden, basketball coach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070822/75e84db1/attachment.html
More information about the FX.php_List
mailing list