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 Fries BrainScan Software On 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:

    
  1. Re: [WebDNA] Conditional search ("Terry Wilson" 2009)
  2. Re: [WebDNA] Conditional search (Frank Nordberg 2009)
  3. Re: [WebDNA] Conditional search ("Terry Wilson" 2009)
  4. Re: [WebDNA] Conditional search (Frank Nordberg 2009)
  5. Re: [WebDNA] Conditional search (Brian Fries 2009)
  6. Re: [WebDNA] Conditional search ("Dan Strong" 2009)
  7. Re: [WebDNA] Conditional search (Terry Wilson 2009)
  8. Re: [WebDNA] Conditional search (Tom Duke 2009)
  9. [WebDNA] Conditional search ("Ki Song - Knifecenter.com" 2009)
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 Fries BrainScan Software On 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:

Reloading Shopping Carts (1998) Newbie problem blah blah blah (1997) A question on sub-categories (1997) OSX SubAdmin Templates (2000) date display (1999) [WebDNA] New Years Wish... WebDNA (2009) docs for WebCatalog2 (1997) RequiredFields template (1997) So, does anyone have developer editon running on Win XP (2006) Permissions / Restart WebDNA? (2005) weening me off overwriting form variables. John Peacock? (2000) http or https? (2001) .txt file (2000) what the... (2004) Subcription Sales w/WebCatalog (1999) Taxable Shipping (2003) Not really WebCat - need HTML Grider (1997) webcat- multiple selection in input field (1997) unable to launch acgi in WebCat (1997) PIXO support (1997)