Re: [WebDNA] maybe silly suggestion? [founditems]

This WebDNA talk-list message is from

2015


It keeps the original formatting.
numero = 111908
interpreted = N
texte = It seems to me a little complicated: let=E2=80=99s take your example [search = people.db&eqfirstnamedatarq=3D[firstname]&allhit=3D1&lastnamesort=3D1&max=3D= 25] [if [numfound]=3D0][then] [DO ERROR STUFF] [/then][else] [savefounditems namepeople] [/else][/if] [/search] This is fine for a two columns database, but if the database includes 10 = columns, is [savefounditems] supposed to store everything? what should = be the format of the data stored? how would it be sorted by [showpeople = namepeople] we could do that instead of [savefounditems namepeople]: [text]name[index]=3D[firstname],[/text] which will give us name1=3DJim,name2=3DBob,name3=3DChris,name4=3DBrian - chris > On 15 Jan 2015, at 21:27, iPhonzie@G wrote: >=20 > I really like the idea of [savefounditems] / [displayfounditems] (or = maybe [listfounditems] for consistency with other looping context = names). >=20 > Chris, if your [sto] concept is about persistent globally available = values, then I don=E2=80=99t think that applies to the need here - the = saved results generally only need to persist for the life of the current = page. >=20 > Internal to the WebDNA engine, this may well leverage the same code as = [table] - the [savefounditems] could create a private table and = [listfounditems] could execute a generic unranked search of that table >=20 > With [savefounditems], you could save several sets of searches on the = same database, such as =E2=80=9Cpeoplenameddave=E2=80=9D and = =E2=80=9Cpeoplefromalbuquerque=E2=80=9D, gathered at the top of your = page with appropriate error responses, etc. Later in the display portion = of your page you could call a common function to display HTML tables of = Daves and Albequerqians. >=20 > So, given a page with formvariables =E2=80=9Cfirstname=E2=80=9D and = =E2=80=9Ccity=E2=80=9D, the top of your code could do: >=20 > [search = people.db&eqfirstnamedatarq=3D[firstname]&allhit=3D1&lastnamesort=3D1&max=3D= 25] > [if [numfound]=3D0][then] > DO ERROR STUFF] > [/then][else] > [savefounditems namepeople] > [/else][/if] > [/search] >=20 > [search = people.db&eqcitydatarq=3D[city]&allhit=3D1&lastnamesort=3D1&firstnamesort=3D= 2&max=3D25] > [if [numfound]=3D0][then] > DO ERROR STUFF] > [/then][else] > [savefounditems citypeople] > [/else][/if] > [/search] >=20 > [function name=3Dshowpeople] > > [listfounditems [params_string]] > = > [/listfounditems] >
[index]][firstname][lastname][city][any field in people.db]
> [/function] > =09 > Later in the display code you could do: >=20 > People named [firstname]: > [showpeople namepeople] >=20 > People from [city]: > [showpeople citypeople] >=20 >=20 > =E2=80=94 Brian Fries >=20 > On January 15, 2015 at 9:55:07 AM, Terry Wilson (terry@terryfic.com) = wrote: >=20 >> Or just put the search parameters in a variable up top to retrieve as = needed with showifs. This is quite handy for repurposing found items = loops, such as a nicely formatted table of info that is sorted by = various fields (just discussed this a few days ago). This has the added = benefit of letting you keep constants like eventdatetype=3Ddate, max=3D25,= etc in the actual search code to keep your parameters easier to read = and manage. This would certainly put your controller logic separate from = your display code.=20 >>=20 >> [showif = [somesearch]=3Dt][text]searchforwhat=3Ddb=3Dallthethings.db&blahblahblah[/= text][/showif]=20 >> [showif = [someothersearch]=3Dt][text]searchforwhat=3Ddb=3Dallthethings.db&blahblahb= lah[/text][/showif]=20 >>=20 >> [search [searchforwhat]&max=3D25&lastnamesort=3D1]=20 >>=20 >> > =20 >> > =20 >> > On Jan 14, 2015, at 2:57 PM, Brian Burton = wrote:=20 >> > =20 >> >> to help separate my controller logic from my display code it would = be awesome to have a shortcut like:=20 >> >> [search db=3Dallthethings.db&blahblahblah][savefounditems = name=3Dpeoplenameddave][/search]=20 >> >> =20 >> >> =20 >> >> =20 >> >> =20 >> >> then later in the page, where i=E2=80=99m rendering the html=20 >> >> [displayfounditems use=3Dpeoplenameddave] html things = [/displayfounditems]=20 >> >> =20 >> >> =20 >> >> =20 >> >> I know it looks like it=E2=80=99s not saving that much code, but I = can see switching which search I want in the controller, and still being = able to use a universal founditems loop lower in the code. Also the = ability to reuse search results (if needed) without doing the same = search again. =20 >> >> =20 >> >> ok, feel free to start telling me how you can do this with a table = (you=E2=80=99re missing the point) or how we don=E2=80=99t need more = tags or whatever :) =20 >> >> =20 >> >> =20 >> >> -Brian B. Burton=20 >>=20 > --------------------------------------------------------- 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 Bug Reporting: = support@webdna.us Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  2. Re: [WebDNA] maybe silly suggestion? [founditems] (christophe.billiottet@webdna.us 2015)
  3. Re: [WebDNA] maybe silly suggestion? [founditems] (Michael Davis 2015)
  4. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  5. Re: [WebDNA] maybe silly suggestion? [founditems] (christophe.billiottet@webdna.us 2015)
  6. Re: [WebDNA] maybe silly suggestion? [founditems] (Stuart Tremain 2015)
  7. Re: [WebDNA] maybe silly suggestion? [founditems] (Dan Strong 2015)
  8. Re: [WebDNA] maybe silly suggestion? [founditems] (Brian Burton 2015)
  9. Re: [WebDNA] maybe silly suggestion? [founditems] (Brian Burton 2015)
  10. Re: [WebDNA] maybe silly suggestion? [founditems] (Dan Strong 2015)
  11. Re: [WebDNA] maybe silly suggestion? [founditems] (Brian Burton 2015)
  12. Re: [WebDNA] maybe silly suggestion? [founditems] (=?utf-8?Q?iPhonzie=40G?= 2015)
  13. Re: [WebDNA] maybe silly suggestion? [founditems] (Brian Burton 2015)
  14. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  15. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  16. Re: [WebDNA] maybe silly suggestion? [founditems] (Dan Strong 2015)
  17. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  18. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  19. Re: [WebDNA] maybe silly suggestion? [founditems] (=?utf-8?Q?iPhonzie=40G?= 2015)
  20. Re: [WebDNA] maybe silly suggestion? [founditems] (=?utf-8?Q?iPhonzie=40G?= 2015)
  21. Re: [WebDNA] maybe silly suggestion? [founditems] (christophe.billiottet@webdna.us 2015)
  22. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  23. Re: [WebDNA] maybe silly suggestion? [founditems] (=?utf-8?Q?iPhonzie=40G?= 2015)
  24. Re: [WebDNA] maybe silly suggestion? [founditems] (=?utf-8?Q?iPhonzie=40G?= 2015)
  25. Re: [WebDNA] maybe silly suggestion? [founditems] (Stephen Reiss 2015)
  26. Re: [WebDNA] maybe silly suggestion? [founditems] (Terry Wilson 2015)
  27. Re: [WebDNA] maybe silly suggestion? [founditems] (Terry Wilson 2015)
  28. Re: [WebDNA] maybe silly suggestion? [founditems] (Lawrence Banahan 2015)
  29. Re: [WebDNA] maybe silly suggestion? [founditems] ("Psi Prime Inc, Matthew A Perosi " 2015)
  30. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  31. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  32. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  33. Re: [WebDNA] maybe silly suggestion? [founditems] (Terry Wilson 2015)
  34. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  35. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  36. Re: [WebDNA] maybe silly suggestion? [founditems] (Terry Wilson 2015)
  37. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  38. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  39. Re: [WebDNA] maybe silly suggestion? [founditems] (Donovan Brooke 2015)
  40. Re: [WebDNA] maybe silly suggestion? [founditems] (christophe.billiottet@webdna.us 2015)
  41. Re: [WebDNA] maybe silly suggestion? [founditems] (Kenneth Grome 2015)
  42. [WebDNA] maybe silly suggestion? [founditems] (Brian Burton 2015)
It seems to me a little complicated: let=E2=80=99s take your example [search = people.db&eqfirstnamedatarq=3D[firstname]&allhit=3D1&lastnamesort=3D1&max=3D= 25] [if [numfound]=3D0][then] [DO ERROR STUFF] [/then][else] [savefounditems namepeople] [/else][/if] [/search] This is fine for a two columns database, but if the database includes 10 = columns, is [savefounditems] supposed to store everything? what should = be the format of the data stored? how would it be sorted by [showpeople = namepeople] we could do that instead of [savefounditems namepeople]: [text]name[index]=3D[firstname],[/text] which will give us name1=3DJim,name2=3DBob,name3=3DChris,name4=3DBrian - chris > On 15 Jan 2015, at 21:27, iPhonzie@G wrote: >=20 > I really like the idea of [savefounditems] / [displayfounditems] (or = maybe [listfounditems] for consistency with other looping context = names). >=20 > Chris, if your [sto] concept is about persistent globally available = values, then I don=E2=80=99t think that applies to the need here - the = saved results generally only need to persist for the life of the current = page. >=20 > Internal to the WebDNA engine, this may well leverage the same code as = [table] - the [savefounditems] could create a private table and = [listfounditems] could execute a generic unranked search of that table >=20 > With [savefounditems], you could save several sets of searches on the = same database, such as =E2=80=9Cpeoplenameddave=E2=80=9D and = =E2=80=9Cpeoplefromalbuquerque=E2=80=9D, gathered at the top of your = page with appropriate error responses, etc. Later in the display portion = of your page you could call a common function to display HTML tables of = Daves and Albequerqians. >=20 > So, given a page with formvariables =E2=80=9Cfirstname=E2=80=9D and = =E2=80=9Ccity=E2=80=9D, the top of your code could do: >=20 > [search = people.db&eqfirstnamedatarq=3D[firstname]&allhit=3D1&lastnamesort=3D1&max=3D= 25] > [if [numfound]=3D0][then] > DO ERROR STUFF] > [/then][else] > [savefounditems namepeople] > [/else][/if] > [/search] >=20 > [search = people.db&eqcitydatarq=3D[city]&allhit=3D1&lastnamesort=3D1&firstnamesort=3D= 2&max=3D25] > [if [numfound]=3D0][then] > DO ERROR STUFF] > [/then][else] > [savefounditems citypeople] > [/else][/if] > [/search] >=20 > [function name=3Dshowpeople] > > [listfounditems [params_string]] > = > [/listfounditems] >
[index]][firstname][lastname][city][any field in people.db]
> [/function] > =09 > Later in the display code you could do: >=20 > People named [firstname]: > [showpeople namepeople] >=20 > People from [city]: > [showpeople citypeople] >=20 >=20 > =E2=80=94 Brian Fries >=20 > On January 15, 2015 at 9:55:07 AM, Terry Wilson (terry@terryfic.com) = wrote: >=20 >> Or just put the search parameters in a variable up top to retrieve as = needed with showifs. This is quite handy for repurposing found items = loops, such as a nicely formatted table of info that is sorted by = various fields (just discussed this a few days ago). This has the added = benefit of letting you keep constants like eventdatetype=3Ddate, max=3D25,= etc in the actual search code to keep your parameters easier to read = and manage. This would certainly put your controller logic separate from = your display code.=20 >>=20 >> [showif = [somesearch]=3Dt][text]searchforwhat=3Ddb=3Dallthethings.db&blahblahblah[/= text][/showif]=20 >> [showif = [someothersearch]=3Dt][text]searchforwhat=3Ddb=3Dallthethings.db&blahblahb= lah[/text][/showif]=20 >>=20 >> [search [searchforwhat]&max=3D25&lastnamesort=3D1]=20 >>=20 >> > =20 >> > =20 >> > On Jan 14, 2015, at 2:57 PM, Brian Burton = wrote:=20 >> > =20 >> >> to help separate my controller logic from my display code it would = be awesome to have a shortcut like:=20 >> >> [search db=3Dallthethings.db&blahblahblah][savefounditems = name=3Dpeoplenameddave][/search]=20 >> >> =20 >> >> =20 >> >> =20 >> >> =20 >> >> then later in the page, where i=E2=80=99m rendering the html=20 >> >> [displayfounditems use=3Dpeoplenameddave] html things = [/displayfounditems]=20 >> >> =20 >> >> =20 >> >> =20 >> >> I know it looks like it=E2=80=99s not saving that much code, but I = can see switching which search I want in the controller, and still being = able to use a universal founditems loop lower in the code. Also the = ability to reuse search results (if needed) without doing the same = search again. =20 >> >> =20 >> >> ok, feel free to start telling me how you can do this with a table = (you=E2=80=99re missing the point) or how we don=E2=80=99t need more = tags or whatever :) =20 >> >> =20 >> >> =20 >> >> -Brian B. Burton=20 >>=20 > --------------------------------------------------------- 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 Bug Reporting: = support@webdna.us christophe.billiottet@webdna.us

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:

WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (1997) WebCat2 - Getting to the browser's username/password data (1997) Purchase *file=* bug? (2003) [WebDNA] Digest Mode (2008) Execute Applescript (1997) WC2b15 File Corruption (1997) WebCat2 - storing unformatted date data? (1997) Menu Madness (2001) WebMerchant Only reads 1.4 order files error (1997) [WebDNA] New Server Setup (2016) Credit Card Number checking (1997) RequiredFields template (1997) form variables (2000) Me know logical no need (2002) SMSI FTP - calander system THANKS! (2002) Webstar 1.3.1 PPC (1997) WCS Newbie question (1997) Multiple fields on 1 input (1997) WebCat2 Append problem (B14Macacgi) (1997) WC2f3 (1997)