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:

same bill to and ship to? (1998) WebCatalog NT beta 18 now available (1997) Include a big block of text (1997) Multiple catalog databases and showcart (1997) [WebDNA] multi [sendmail] inside [search] (2012) Accepting credit cards (1997) WebCat2b13MacPlugin - [math][date][/math] problem (1997) (1997) FORMS: Returning a specific page (1997) WebDNA Solutions ... sorry! (1997) Country & Ship-to address & other fields ? (1997) (2003) Database Connectivity (1999) HTTP "host" header (2003) Protect vs Authenicate (1997) searching by date (1998) WebDNA Solutions ... sorry! (1997) Date calculation problems (1997) RE: search same field twice??? (1999) Feature: TCPconnect via SSL (1999)