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:
Searching multiple Databases (1997)
More on the email templates (1997)
Nested vs conditional (1997)
Almost a there but..bye bye NetCloak (1997)
More Applescript (1997)
WCS Newbie question (1997)
Re:Running 2 two WebCatalog.acgi's (1996)
WebSTAR 2.1 freezes my Mac (1997)
[WebDNA] SQL with Webdna - good ideas? (2018)
Template Security error (1997)
Summaries (1999)
AOL (1999)
WebCatalog/WebMerchant bug? (1999)
The beginning (1997)
Further tests with the infamous shipCost (1997)
OSX Jaguar (2002)
Mac webcatalog3_0_5b11 more dead lock throws (1999)
Summ=T Problem (1997)
$flushdatabases question ... (1998)
Authenticate (1999)