Re: [WebDNA] Conditional search
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 103067
interpreted = N
texte = If you want the same code to be executed regardless of which search is successful, then a function is a great way to handle this...[function name=handleTheSearch](header)[founditems](line items)[/founditems](footer)[/function][search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url][srch][/ url]][if [numfound]=0][then] [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] [srch][/url]][handleTheSearch] [/search][/then][else][handleTheSearch][/else][/if][/search]And Dan... the [/search] is required by the WebDNA language syntax. Sometimes a page will still work if it is left off (WebDNA tries to do it's best to work around syntax errors), but missing end tags can wreak major havoc on your code.Brian FriesBrainScan SoftwareOn Jul 30, 2009, at 3:02 PM, Dan Strong wrote:> Not directly related (and won't solve your issue), but IIRC [/ > search] isn't really needed to "close" a [search], it's just better > syntax (to me), and a habit I got into early. -Dan>>>> On Thu, 30 Jul 2009 17:38:49 -0400> Terry Wilson
wrote:>> You can't hop-scotch through opening and closing tags; nest things >> properly. The first search is done the moment it finds 0 records, >> so you don't have to put the closing tag before doing the second >> search. Nest everything it will be fine:>> [search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url] >> [srch][/url]]>> [showif [numfound]=0]>> [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] >> [srch][/url]]>> stuff found in the second search>> [/search]>> [/showif]>> [/search]>> Terry>> If numfound = 0 on the first search, I expect it to close that >> search and start a new search:>> [search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url] >> [srch][/url]]>> [showif [numfound]=0]>> [/search]>> [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] >> [srch][/url]]>> [/showif]>> However, this is not working properly. Instead of closing the >> search with [/search], it just displays [/search] and [/showif] as >> text.>> Any ideas?>> ----------->> Ki Song>> -- >> Terry Wilson | terry@terryfic.com | http://terryfic.com>> http://WhosComing.com - a simplified, affordable online reservation >> system>> http://TightJacket.com -- stylish protection for your laptop>> -------------------------------------------------------------------------->> Attitude is the only difference between ordeal and adventure.>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> old archives: http://dev.webdna.us/TalkListArchive/
Associated Messages, from the most recent to the oldest:
If you want the same code to be executed regardless of which search is successful, then a function is a great way to handle this...[function name=handleTheSearch](header)[founditems](line items)[/founditems](footer)[/function][search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url][srch][/ url]][if [numfound]=0][then] [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] [srch][/url]][handleTheSearch] [/search][/then][else][handleTheSearch][/else][/if][/search]And Dan... the [/search] is required by the WebDNA language syntax. Sometimes a page will still work if it is left off (WebDNA tries to do it's best to work around syntax errors), but missing end tags can wreak major havoc on your code.Brian FriesBrainScan SoftwareOn Jul 30, 2009, at 3:02 PM, Dan Strong wrote:> Not directly related (and won't solve your issue), but IIRC [/ > search] isn't really needed to "close" a [search], it's just better > syntax (to me), and a habit I got into early. -Dan>>>> On Thu, 30 Jul 2009 17:38:49 -0400> Terry Wilson wrote:>> You can't hop-scotch through opening and closing tags; nest things >> properly. The first search is done the moment it finds 0 records, >> so you don't have to put the closing tag before doing the second >> search. Nest everything it will be fine:>> [search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url] >> [srch][/url]]>> [showif [numfound]=0]>> [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] >> [srch][/url]]>> stuff found in the second search>> [/search]>> [/showif]>> [/search]>> Terry>> If numfound = 0 on the first search, I expect it to close that >> search and start a new search:>> [search db=^db/products.db&group1field=SKU&waGROUP1datarq=[url] >> [srch][/url]]>> [showif [numfound]=0]>> [/search]>> [search db=^db/products.db&group1field=SKU&woGROUP1datarq=[url] >> [srch][/url]]>> [/showif]>> However, this is not working properly. Instead of closing the >> search with [/search], it just displays [/search] and [/showif] as >> text.>> Any ideas?>> ----------->> Ki Song>> -- >> Terry Wilson | terry@terryfic.com | http://terryfic.com>> http://WhosComing.com - a simplified, affordable online reservation >> system>> http://TightJacket.com -- stylish protection for your laptop>> -------------------------------------------------------------------------->> Attitude is the only difference between ordeal and adventure.>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> old archives: http://dev.webdna.us/TalkListArchive/
Brian Fries
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:
WebCat2final1 crashes (1997)
problems with 2 tags (1997)
redirect from the errorsMessages.db entry (1997)
before after on (1998)
Answer: WebDelivery downloads alias, not original ? (1997)
comparisons using [ImageHeight] inside [fileinfo] giving (2004)
ErrorMessages.db suggestion (1997)
[math] variable question (1997)
How To question on setting up downloads (1997)
Sandboxes & Kitty Litter trays (2003)
price formula (1999)
E-mail formating question (1999)
Some Questions (1997)
WC 2.0 frames feature (1997)
encryption (2003)
Web Catalog 2 demo (1997)
different show next (1997)
UPS, FEDEX TRACKING (1999)
# fields limited? (1997)
method of payment (1997)