Re: searching with if/then
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 58052
interpreted = N
texte = Aside from the numerous other posts already (and sorry if this suggestion has come up already)...my suggestion would be to take the if/else/then out of the search string itself. Personally, I would resolve the if/else/then above the search string and deposit the results into a textvar that you could then populate the search string with.(rough example):[showif [fontsrch]=T] [text show=f]GROUPONEIS=[Url]nohtml+fontname+foundry+fampkg+[/Url][/text][/showif][showif [fontsrch]=F] [If ("[famsrch]"="T")] [Then][text show=f]GROUPONEIS=[url]&eqFAMDISPdatarq=T[/url][/text][/Then] [Else][text show=f]GROUPONEIS=[Url][math show=F]err=0,err_num=0[/math][/Url][/text][/Else] [/If][/showif][search db=../../www.philsfonts.com/vault/philsfonts.db[!][/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[GROUPONEIS][!][/!]&etc......[/search]Note, and not sure if Donovan pointed this out in his post where he broke down the entire string, but your IF/THEN logic doesn't fit. You have:[/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[!]...snip..[/!][If(([fontsrch]=F)&([famsrch]=T))][Then]&eqFAMDISPdatarq=T[/Then][/If][!]which if the conditions are met, you're saying &GROUP1FIELD=&eqFAMDISPdatarq=TNote also, and I think this came up before and not sure what the consensus was, but for the IF statement, I've found it necessary to put the quote marks around the conditions.GKAt 06:57 PM 5/24/2004, you wrote:>Hello all,>>First post ever!>>Anybody know why the heck this isn't working... I can explain more if>needed:>>[search db=../../www.philsfonts.com/vault/philsfonts.db[!]>[/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[!]>[/!][If(([fontsrch]=T)&([famsrch]=T))][Then]nohtml+fontname+foundry+famp >kg+[/Then][/If][!]>[/!][If(([fontsrch]=T)&([famsrch]=F))][Then]nohtml+fontname+foundry+famp >kg+[/Then][/If][!]>[/!][If(([fontsrch]=F)&([famsrch]=T))][Then]&eqFAMDISPdatarq=T[/Then][/ If][!]>[/!][If(([fontsrch]=F)&([famsrch]=F))][Then][math>show=F]err=0,err_num=0[/math][/Then][/If][!]>[/!][showif>[foundrystring]!]&woFOUNDRYdatarq=[foundrystring]&FOUNDRYword=sw&FOUNDRY >wbrk=,[/showif][!]>[/!][showif [designer]!]&eqDESIGNERdatarq=[designer][/showif][!]>[/!][showif>[classstring]!]&woCLASSIFICATIONdatarq=[classstring]&CLASSIFICATIONword= >sw&CLASSIFICATIONwbrk=,[/showif][!]>[/!]&MANOPTsort=1&MANOPTtype=text&MANOPTsdir=de&FONTNAMEsort=2&FONTNAMEt >ype=text&FONTNAMEsdir=as&VOLPKGNUMsort=3&FONTNAMEsumm=T&startat=[startat >]&max=[rslts]][/showif][/search]>>>Not sure if this is the right way to phrase this but... we're trying to>assign the different search parameters with various if/then conditional>statements and some [showif]'s. Not working. When we try to access the>[founditems] later on in the code, it's telling me it can't because>there is no search context. This was an experiment. So it may be way>off. Just thought I'd check. Thanks for any help!>>Jon-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Aside from the numerous other posts already (and sorry if this suggestion has come up already)...my suggestion would be to take the if/else/then out of the search string itself. Personally, I would resolve the if/else/then above the search string and deposit the results into a textvar that you could then populate the search string with.(rough example):[showif [fontsrch]=T] [text show=f]GROUPONEIS=[url]nohtml+fontname+foundry+fampkg+[/Url][/text][/showif][showif [fontsrch]=F] [If ("[famsrch]"="T")] [Then][text show=f]GROUPONEIS=[url]&eqFAMDISPdatarq=T[/url][/text][/Then] [Else][text show=f]GROUPONEIS=[url][math show=F]err=0,err_num=0[/math][/Url][/text][/Else] [/If][/showif][search db=../../www.philsfonts.com/vault/philsfonts.db[!][/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[GROUPONEIS][!][/!]&etc......[/search]Note, and not sure if Donovan pointed this out in his post where he broke down the entire string, but your IF/THEN logic doesn't fit. You have:[/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[!]...snip..[/!][If(([fontsrch]=F)&([famsrch]=T))][Then]&eqFAMDISPdatarq=T[/Then][/If][!]which if the conditions are met, you're saying &GROUP1FIELD=&eqFAMDISPdatarq=TNote also, and I think this came up before and not sure what the consensus was, but for the IF statement, I've found it necessary to put the quote marks around the conditions.GKAt 06:57 PM 5/24/2004, you wrote:>Hello all,>>First post ever!>>Anybody know why the heck this isn't working... I can explain more if>needed:>>[search db=../../www.philsfonts.com/vault/philsfonts.db[!]>[/!][showif [keyword]!]&[wrd]GROUP1datarq=[keyword]&GROUP1FIELD=[!]>[/!][If(([fontsrch]=T)&([famsrch]=T))][Then]nohtml+fontname+foundry+famp >kg+[/Then][/If][!]>[/!][If(([fontsrch]=T)&([famsrch]=F))][Then]nohtml+fontname+foundry+famp >kg+[/Then][/If][!]>[/!][If(([fontsrch]=F)&([famsrch]=T))][Then]&eqFAMDISPdatarq=T[/Then][/ If][!]>[/!][If(([fontsrch]=F)&([famsrch]=F))][Then][math>show=F]err=0,err_num=0[/math][/Then][/If][!]>[/!][showif>[foundrystring]!]&woFOUNDRYdatarq=[foundrystring]&FOUNDRYword=sw&FOUNDRY >wbrk=,[/showif][!]>[/!][showif [designer]!]&eqDESIGNERdatarq=[designer][/showif][!]>[/!][showif>[classstring]!]&woCLASSIFICATIONdatarq=[classstring]&CLASSIFICATIONword= >sw&CLASSIFICATIONwbrk=,[/showif][!]>[/!]&MANOPTsort=1&MANOPTtype=text&MANOPTsdir=de&FONTNAMEsort=2&FONTNAMEt >ype=text&FONTNAMEsdir=as&VOLPKGNUMsort=3&FONTNAMEsumm=T&startat=[startat >]&max=[rslts]][/showif][/search]>>>Not sure if this is the right way to phrase this but... we're trying to>assign the different search parameters with various if/then conditional>statements and some [showif]'s. Not working. When we try to access the>[founditems] later on in the code, it's telling me it can't because>there is no search context. This was an experiment. So it may be way>off. Just thought I'd check. Thanks for any help!>>Jon-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Gary Krockover
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:
Re:Emailer and encryption (1997)
WebCat2 - [include] tags (1997)
carriage returns in data (1997)
Form based Redirect (2001)
2nd WebCatalog2 Feature Request (1996)
html delivery (1997)
ISPs and WebCat (2001)
Customizing WebDelivery.html (1998)
Upgrading old WebCat Database Files (1997)
FTP via Shell Question (2005)
Summing fields (1997)
security (1997)
locking variables? (2000)
Doesn't change (WebCat 4.0) (2000)
Error Lob.db records error message not name (1997)
Bulk Email Limits (2001)
I'm new be kind (1997)
Showif -what am I missing??? (1999)
shipCost (1998)
WebCat2b15MacPlugIn - [authenticate] not [protect] (1997)