Re: [WebDNA] maybe silly suggestion? [founditems]
This WebDNA talk-list message is from 2015
It keeps the original formatting.
numero = 111904
interpreted = N
texte = --54b806a9_66334873_12aContent-Type: text/plain; charset="utf-8"Content-Transfer-Encoding: quoted-printableContent-Disposition: inlineI really like the idea of =5Bsavefounditems=5D / =5Bdisplayfounditems=5D =(or maybe =5Blistfounditems=5D for consistency with other looping context= names).Chris, if your =5Bsto=5D concept is about persistent globally available v=alues, then I don=E2=80=99t think that applies to the need here - the sav=ed results generally only need to persist for the life of the current pag=e.Internal to the WebDNA engine, this may well leverage the same code as =5B=table=5D - the =5Bsavefounditems=5D could create a private table and =5Bl=istfounditems=5D could execute a generic unranked search of that tableWith =5Bsavefounditems=5D, you could save several sets of searches on the= same database, such as =E2=80=9Cpeoplenameddave=E2=80=9D and =E2=80=9Cpe=oplefromalbuquerque=E2=80=9D, gathered at the top of your page with appro=priate error responses, etc. Later in the display portion of your page yo=u could call a common function to display HTML tables of Daves and Albequ=erqians.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:=5Bsearch people.db&eqfirstnamedatarq=3D=5Bfirstname=5D&allhit=3D1&lastna=mesort=3D1&max=3D25=5D=C2=A0 =C2=A0 =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D=C2=A0 =C2=A0 =C2=A0 =C2=A0 DO ERROR STU=46=46=5D=C2=A0 =C2=A0 =5B/then=5D=5Belse=5D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bsavefounditems namepeople=5D=C2=A0 =C2=A0=5B/else=5D=5B/if=5D=5B/search=5D=5Bsearch people.db&eqcitydatarq=3D=5Bcity=5D&allhit=3D1&lastnamesort=3D1=&firstnamesort=3D2&max=3D25=5D=C2=A0 =C2=A0 =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D=C2=A0 =C2=A0 =C2=A0 =C2=A0 DO ERROR STU=46=46=5D=C2=A0 =C2=A0 =5B/then=5D=5Belse=5D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bsavefounditems citypeople=5D=C2=A0 =C2=A0=5B/else=5D=5B/if=5D=5B/search=5D=5Bfunction name=3Dshowpeople=5D=C2=A0 =C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Blistfounditems =5Bparams=5Fstring=5D=5D=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bindex=5D=5D | ==5Bfirstname=5D | =5Blastname=5D | =5Bcity=5D | =5Bany =field in people.db=5D |
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =5B/listfounditems=5D=C2=A0 =C2=A0
=5B/function=5D=09Later in the display code you could do:People named =5Bfirstname=5D:=5Bshowpeople namepeople=5DPeople from =5Bcity=5D:=5Bshowpeople citypeople=5D=E2=80=94 Brian =46riesOn January 15, 2015 at 9:55:07 AM, Terry Wilson (terry=40terryfic.com) wr=ote:Or just put the search parameters in a variable up top to retrieve as nee=ded 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 lett=ing you keep constants like eventdatetype=3Ddate, max=3D25, etc in the ac=tual search code to keep your parameters easier to read and manage. This =would certainly put your controller logic separate from your display code=. =20=5Bshowif =5Bsomesearch=5D=3Dt=5D=5Btext=5Dsearchforwhat=3Ddb=3Dallthethi=ngs.db&blahblahblah=5B/text=5D=5B/showif=5D =20=5Bshowif =5Bsomeothersearch=5D=3Dt=5D=5Btext=5Dsearchforwhat=3Ddb=3Dallt=hethings.db&blahblahblah=5B/text=5D=5B/showif=5D =20=5Bsearch =5Bsearchforwhat=5D&max=3D25&lastnamesort=3D1=5D =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>> =5Bsearch db=3Dallthethings.db&blahblahblah=5D=5Bsavefounditems name=3D=peoplenameddave=5D=5B/search=5D =20>> =20>> =20>> =20>> =20>> then later in the page, where i=E2=80=99m rendering the html =20>> =5Bdisplayfounditems use=3Dpeoplenameddave=5D html things =5B/displayf=ounditems=5D =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 abl=e 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 (yo=u=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--54b806a9_66334873_12aContent-Type: text/html; charset="utf-8"Content-Transfer-Encoding: quoted-printableContent-Disposition: inline