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

This WebDNA talk-list message is from

2015


It keeps the original formatting.
numero = 111910
interpreted = N
texte = --54b817e9_46e87ccd_12a Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Chris - =C2=A0I think I addressed your question briefly before: =22Internal to the WebDNA engine, this may well leverage the same code as= =5Btable=5D - the =5Bsavefounditems=5D could create a private table and = =5Blistfounditems=5D could execute a generic unranked search of that tabl= e=E2=80=9D So a saved found item set would=C2=A0essentially be a private table,=C2=A0= that the engine has access to but the developer can only=C2=A0access via = =5Blistfounditems=5D. I do similar things with currently available syntax in some cases, but it= =E2=80=99s messy and could be much more efficient done in the WebDNA engi= ne. Here=E2=80=99s the example using tables=C2=A0(sans performance optimizati= ons): =5Btable name=3Dnamepeople&fields=3D=5Blistfields people.db=5D=5Bfieldnam= e=5D,=5B/listfields=5D=5D=5B/table=5D =5Bsearch db=3Dpeople.db&eqfirstnamedatarq=3D=5Bfirstname=5D&allhit=3D1&l= astnamesort=3D1&max=3D25=5D =C2=A0 =C2=A0 =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5BDO ERROR STU=46=46=5D =C2=A0 =C2=A0 =5B/then=5D=5Belse=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bfounditems=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bappend table=3Dnamepeople=5D= =5Blistfields people.db=5D=5Bshowif =5Bindex=5D>1=5D&=5B/showif=5D=5Bfiel= dname=5D=3D=5Burl=5D=5Binterpret=5D=5B=5Bfieldname=5D=5D=5B/interpret=5D=5B= /url=5D=5B/listfields=5D=5B/append=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5B/founditems=5D =C2=A0 =C2=A0 =5B/else=5D=5B/if=5D =5B/search=5D =5Btable name=3Dcitypeople&fields=3D=5Blistfields people.db=5D=5Bfieldnam= e=5D,=5B/listfields=5D=5D=5B/table=5D =5Bsearch db=3Dpeople.db&eqcitydatarq=3D=5Bcity=5D&allhit=3D1&lastnamesor= t=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 =5BDO ERROR STU=46=46=5D =C2=A0 =C2=A0 =5B/then=5D=5Belse=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bfounditems=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bappend table=3Dcitypeople=5D= =5Blistfields people.db=5D=5Bshowif =5Bindex=5D>1=5D&=5B/showif=5D=5Bfiel= dname=5D=3D=5Burl=5D=5Binterpret=5D=5B=5Bfieldname=5D=5D=5B/interpret=5D=5B= /url=5D=5B/listfields=5D=5B/append=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5B/founditems=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 =5Bsearch table=3D=5Bparams=5Fstring=5D&nefir= stnamedatarq=3D=5Fbogus=5F&rank=3Doff=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bfounditems=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bindex=5D=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bfirstname=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Blastname=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bcity=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5Bany field in people.db=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5B/founditems=5D =C2=A0 =C2=A0 =C2=A0 =C2=A0 =5B/search=5D =C2=A0 =C2=A0
=5B/function=5D =E2=80=A6 People named =5Bfirstname=5D: =5Bshowpeople namepeople=5D People from =5Bcity=5D: =5Bshowpeople citypeople=5D =E2=80=94 Brian =46ries On January 15, 2015 at 11:16:15 AM, christophe.billiottet=40webdna.us (ch= ristophe.billiottet=40webdna.us) wrote: It seems to me a little complicated: let=E2=80=99s take your example =20 =5Bsearch people.db&eqfirstnamedatarq=3D=5Bfirstname=5D&allhit=3D1&lastna= mesort=3D1&max=3D25=5D =20 =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D =20 =5BDO ERROR STU=46=46=5D =20 =5B/then=5D=5Belse=5D =20 =5Bsavefounditems namepeople=5D =20 =5B/else=5D=5B/if=5D =20 =5B/search=5D =20 This is fine for a two columns database, but if the database includes 10 = columns, is =5Bsavefounditems=5D supposed to store everything=3F what sho= uld be the format of the data stored=3F how would it be sorted by =5Bshow= people namepeople=5D =20 we could do that instead of =5Bsavefounditems namepeople=5D: =20 =5Btext=5Dname=5Bindex=5D=3D=5Bfirstname=5D,=5B/text=5D =20 which will give us =20 name1=3DJim,name2=3DBob,name3=3DChris,name4=3DBrian =20 - chris =20 > On 15 Jan 2015, at 21:27, iPhonzie=40G wrote: =20 > =20 > I really like the idea of =5Bsavefounditems=5D / =5Bdisplayfounditems=5D= (or maybe =5Blistfounditems=5D for consistency with other looping contex= t names). =20 > =20 > Chris, if your =5Bsto=5D concept is about persistent globally available= values, then I don=E2=80=99t think that applies to the need here - the s= aved results generally only need to persist for the life of the current p= age. =20 > =20 > Internal to the WebDNA engine, this may well leverage the same code as = =5Btable=5D - the =5Bsavefounditems=5D could create a private table and =5B= listfounditems=5D could execute a generic unranked search of that table =20 > =20 > With =5Bsavefounditems=5D, you could save several sets of searches on t= he same database, such as =E2=80=9Cpeoplenameddave=E2=80=9D and =E2=80=9C= peoplefromalbuquerque=E2=80=9D, gathered at the top of your page with app= ropriate error responses, etc. Later in the display portion of your page = you could call a common function to display HTML tables of Daves and Albe= querqians. =20 > =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 > =20 > =5Bsearch people.db&eqfirstnamedatarq=3D=5Bfirstname=5D&allhit=3D1&last= namesort=3D1&max=3D25=5D =20 > =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D =20 > DO ERROR STU=46=46=5D =20 > =5B/then=5D=5Belse=5D =20 > =5Bsavefounditems namepeople=5D =20 > =5B/else=5D=5B/if=5D =20 > =5B/search=5D =20 > =20 > =5Bsearch people.db&eqcitydatarq=3D=5Bcity=5D&allhit=3D1&lastnamesort=3D= 1&firstnamesort=3D2&max=3D25=5D =20 > =5Bif =5Bnumfound=5D=3D0=5D=5Bthen=5D =20 > DO ERROR STU=46=46=5D =20 > =5B/then=5D=5Belse=5D =20 > =5Bsavefounditems citypeople=5D =20 > =5B/else=5D=5B/if=5D =20 > =5B/search=5D =20 > =20 > =5Bfunction name=3Dshowpeople=5D =20 > =20 > =5Blistfounditems =5Bparams=5Fstring=5D=5D =20 > =20 > =5B/listfounditems=5D =20 >
=5Bindex=5D=5D=5Bfirstname=5D=5Blastname=5D=5Bcity=5D=5Bany field in people.db=5D
=20 > =5B/function=5D =20 > =20 > Later in the display code you could do: =20 > =20 > People named =5Bfirstname=5D: =20 > =5Bshowpeople namepeople=5D =20 > =20 > People from =5Bcity=5D: =20 > =5Bshowpeople citypeople=5D =20 > =20 > =20 > =E2=80=94 Brian =46ries =20 > =20 > On January 15, 2015 at 9:55:07 AM, Terry Wilson (terry=40terryfic.com) = wrote: =20 > =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 loop= s, such as a nicely formatted table of info that is sorted by various fie= lds (just discussed this a few days ago). This has the added benefit of l= etting you keep constants like eventdatetype=3Ddate, max=3D25, etc in the= actual search code to keep your parameters easier to read and manage. Th= is would certainly put your controller logic separate from your display c= ode. =20 >> =20 >> =5Bshowif =5Bsomesearch=5D=3Dt=5D=5Btext=5Dsearchforwhat=3Ddb=3Dallthe= things.db&blahblahblah=5B/text=5D=5B/showif=5D =20 >> =5Bshowif =5Bsomeothersearch=5D=3Dt=5D=5Btext=5Dsearchforwhat=3Ddb=3Da= llthethings.db&blahblahblah=5B/text=5D=5B/showif=5D =20 >> =20 >> =5Bsearch =5Bsearchforwhat=5D&max=3D25&lastnamesort=3D1=5D =20 >> =20 >> > =20 >> > =20 >> > On Jan 14, 2015, at 2:57 PM, Brian Burton wrot= e: =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 nam= e=3Dpeoplenameddave=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/displ= ayfounditems=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 = able to use a universal founditems loop lower in the code. Also the abili= ty to reuse search results (if needed) without doing the same search agai= n. =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 unsubs= cribe, E-mail to: archives: http://mail.webdna.us/list/talk=40webdna.us B= ug Reporting: support=40webdna.us =20 --------------------------------------------------------- =20 This message is sent to you because you are subscribed to =20 the mailing list . =20 To unsubscribe, E-mail to: =20 archives: http://mail.webdna.us/list/talk=40webdna.us =20 Bug Reporting: support=40webdna.us =20 --54b817e9_46e87ccd_12a Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline