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 can't find database (1997) GIF Converter vs. Clip2Gif (2000) X Server (1999) WebCat2b15MacPlugin - showing [math] (1997) lookups (2000) [OT] iChat (2003) Questions (1998) [WebDNA] Sendmail 'return-path' header that is different to the (2009) WebCat2 - storing unformatted date data? (1997) WC1.6 to WC2 date formatting (1997) database freeze (1997) Search results templates (1996) Newbie from and old bee (1997) WebCat2 - Getting to the browser's username/password data (1997) Refering page (1998) Searching a database... (2003) RE: Include (1998) emailer on Windows Beta 18 (1997) [UPPERCASE] (1997) Question about replacing words (1998)