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:

Repeating Fields (1997) More on the email templates (1997) Is this possible in simple search? question? (1998) WebCat2b13MacPlugIn - syntax to convert date (1997) New Site (1998) Summing fields (1997) [WebDNA] "Technical Reference" link broken in admin (2013) [WebDNA] TCP HTTP/1.1 questions (2011) WebCatalog can't find database (1997) customizing the color of user's pages (1997) [WebDNA] Dynamic vertical columns (2008) [INCLUDE] Limitations-Now I see (1998) Possible Bug in 2.0b15.acgi (1997) WebDNA v6 & MySQL (2008) RE: what characters are replaced for tab and CR? (1998) [AppendFile] problem (WebCat2b13 Mac .acgi) (1997) Emailer (1997) Document Contains No Data! (1997) More Applescript (1997) Re:listfiles-looking for slick solution (1997)