Re: Missing something simple?

This WebDNA talk-list message is from

1999


It keeps the original formatting.
numero = 22318
interpreted = N
texte = On 1/5/1999 3:55 pm, charles kline so noted...>I am using this little bit of code to check if a user name exists in a >custom MyUsers.db > > [ShowIf [Lookup >db=BldrUsers.db&value=[Uppercase][UserName_][/Uppercase]&lookinfield=UserNa >me&ReturnField=UserName&NotFound=]![Uppercase][UserName_][/Uppercase]] > [Append >db=BldrUsers.db]UserName=[Uppercase][UserName_][/Uppercase]&PassWord=[PassW >ord_]&EmailAddr=[EmailAddr_][/Append] > User Added > [/ShowIf] >

> [ShowIf [Lookup >db=BldrUsers.db&value=[Uppercase][UserName_][/Uppercase]&lookinfield=UserNa >me&ReturnField=UserName&NotFound=]=[Uppercase][UserName_][/Uppercase]] > This User Name Already Exists. Try Another! > [/ShowIf] > >It works fine, meaning it functions, but the string This User Name >Already Exists. Try Another! shows no matter what. I want to show this >only if the name exists. > >Is there an easier way to do an If Else type thing?Since your lookup for if the name exists occurs after the append, it will *always* be true. The following doesn't do an if/then/else (which would be a great 4.0 addition, hint, hint ; ) but by storing the state of the first lookup in a text variable, you can test it later without it being effected by the append.[text]UserName_Caps=[Uppercase][UserName_][/Uppercase][/text] [text]UserName_Test=[Lookup db=BldrUsers.db&value=[UserName_Caps]&lookinfield=UserName&ReturnField=User Name&NotFound=][/text][ShowIf [UserName_Test]![UserName_Caps]] [Append db=BldrUsers.db]UserName=[UserName_Caps]&PassWord=[PassWord_]&EmailAddr=[Em ailAddr_][/Append] User Added [/ShowIf]

[ShowIf [UserName_Test]=[UserName_Caps]] This User Name Already Exists. Try Another! [/ShowIf]Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com Associated Messages, from the most recent to the oldest:

    
  1. Re: Missing something simple? (Rob Marquardt 1999)
  2. Re: Missing something simple? (Kenneth Grome 1999)
  3. Missing something simple? (charles kline 1999)
  4. Re: Missing something simple?? (Greg Tabet 1998)
  5. Re: Missing something simple?? (Morris Camp 1998)
  6. Re: Missing something simple?? (Michael Scott Davis 1998)
  7. Re: Missing something simple?? (charles kline 1998)
  8. Missing something simple?? (charles kline 1998)
On 1/5/1999 3:55 pm, charles kline so noted...>I am using this little bit of code to check if a user name exists in a >custom MyUsers.db > > [ShowIf [Lookup >db=BldrUsers.db&value=[uppercase][UserName_][/Uppercase]&lookinfield=UserNa >me&ReturnField=UserName&NotFound=]![uppercase][UserName_][/Uppercase]] > [Append >db=BldrUsers.db]UserName=[uppercase][UserName_][/Uppercase]&PassWord=[PassW >ord_]&EmailAddr=[EmailAddr_][/Append] > User Added > [/ShowIf] >

> [ShowIf [Lookup >db=BldrUsers.db&value=[uppercase][UserName_][/Uppercase]&lookinfield=UserNa >me&ReturnField=UserName&NotFound=]=[uppercase][UserName_][/Uppercase]] > This User Name Already Exists. Try Another! > [/ShowIf] > >It works fine, meaning it functions, but the string This User Name >Already Exists. Try Another! shows no matter what. I want to show this >only if the name exists. > >Is there an easier way to do an If Else type thing?Since your lookup for if the name exists occurs after the append, it will *always* be true. The following doesn't do an if/then/else (which would be a great 4.0 addition, hint, hint ; ) but by storing the state of the first lookup in a text variable, you can test it later without it being effected by the append.[text]UserName_Caps=[uppercase][UserName_][/Uppercase][/text] [text]UserName_Test=[Lookup db=BldrUsers.db&value=[UserName_Caps]&lookinfield=UserName&ReturnField=User Name&NotFound=][/text][ShowIf [UserName_Test]![UserName_Caps]] [Append db=BldrUsers.db]UserName=[UserName_Caps]&PassWord=[PassWord_]&EmailAddr=[Em ailAddr_][/Append] User Added [/ShowIf]

[ShowIf [UserName_Test]=[UserName_Caps]] This User Name Already Exists. Try Another! [/ShowIf]Rob Marquardt Designer/Resident Wirehead Toast Design800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com Rob Marquardt

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[OT] Unix question (2002) Creating main- and sub-category search (1997) Country & Ship-to address & other fields ? (1997) calculate age (2003) WebCatalog for guestbook ? (1997) 'page impression' techniques for banner ads (1999) HELP WITH DATES (1997) Help! (1996) Cant open pages generated by Webcat (2004) Up and running ... at last !! (1997) WebCat2 several catalogs? (1997) WebCatalog Use Question (1997) Nested tags count question (1997) WebCat Hosting (1998) New Guestbook Source (1997) [CART] (1997) Occasional crashes with $remove (1997) Changing SubTotal (2003) Quantity * price (1997) Quit revisited (1997)