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:

Alternating colors (1997) [OT] - Messed up me user permissions - help ! (2004) Opinion: [input] should be called [output] ... (1997) Showif, Hideif reverse logic ? (1997) Database Fields (1997) Sku numbers (1997) Semi-OT SSL IE problem (2005) Browser Problem?!? Still getting Error message using POST! (1997) [OT] (waaaay OT) (2004) Does [Sendmail] create html? (2002) Mac v. NT (1998) authenticate (1999) Can't find templaes (1997) orders (1998) can you take a look (2003) random prob (2003) WebCat on 10.0.4 - iTools 6.0 (2001) WebCat2 beta 11 - new prefs ... (1997) WebCatalog Plug-in for Webstar. (1997) WC 2.0 frames feature (1997)