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:

WebCatalog Upgrade Pricing? (1997) Setting up shop (1997) passing search criteria (1997) [isfile] ? (1997) searching multiple databases (1997) problems with 2 tags (1997) WebCatalog 4.0 has been released! (2000) File Upload Problems (HELP!) (2000) Virtual hosting and webcatNT (1997) OT: Poll Please (2002) 5.1 Wiped My Users (2003) Bug? (1997) Opinion: [input] should be called [output] ... (1997) RSS parser in WebDNA? (2006) WebCat2 several catalogs? (1997) Wrapping text (1998) WebCatalog 2.0 b 15 mac (1997) Execute Applescript (1997) docs for WebCatalog2 (1997) Running _every_ page through WebCat-error.html (1997)