Re: [Zope] ZSQL Method Question
OOPS!!! Actually the "Number of rows in query = <dtml-var "_.len(t1)"><br>" should be inside the with construct like this: <dtml-with "_.namespace(t1=Query.OrderItems())"> Number of rows in query = <dtml-var "_.len(t1)"><br> <dtml-var "t1[0].orderdetid" html_quote> <dtml-var "t1[0].engname" html_quote><br> <dtml-var "t1[1].orderdetid" html_quote> <dtml-var "t1[1].engname" html_quote><br> <dtml-var "t1[2].orderdetid" html_quote> <dtml-var "t1[2].engname" html_quote><br> <dtml-var "t1[1].orderdetid" html_quote> <dtml-var "t1[1].engname" html_quote><br> <dtml-var "t1[5].orderdetid" html_quote> <dtml-var "t1[5].engname" html_quote><br> </dtml-with> (I cut and pasted in pieces and didn't proofread.) __________________________________________________________________ Jim Sanford . Database/Web Engineer / \ / Accelerated Technology, Inc. / / 720 Oak Circle Drive East / / \ Mobile, AL 36609 / / \ Voice: 334-661-5770 fax: 334-661-5788 / \ E-Mail: jsanford@atinucleus.com Web: http://www.atinucleus.com Source Code, No Royalties, Any CPU...It just make sense ! __________________________________________________________________ ----- Original Message ----- From: Carlson, Christopher W. <Christopher.W.Carlson@ct.sgcna.com> To: 'Jim Sanford' <jsanford@atinucleus.com> Sent: Friday, February 25, 2000 9:52 AM Subject: RE: [Zope] ZSQL Method Question That's outstanding. It's obvious that I have a lot of learning to do. Thanks a bunch for the help! --- Chris -----Original Message----- From: Jim Sanford [mailto:jsanford@atinucleus.com] Sent: Friday, February 25, 2000 9:37 AM To: Carlson, Christopher W.; zope@zope.org Subject: Re: [Zope] ZSQL Method Question Your question intrigued me so I played around a little. This works: Number of rows in query = <dtml-var "_.len(t1)"><br> <dtml-with "_.namespace(t1=Query.OrderItems())"> <dtml-var "t1[0].orderdetid" html_quote> <dtml-var "t1[0].engname" html_quote><br> <dtml-var "t1[1].orderdetid" html_quote> <dtml-var "t1[1].engname" html_quote><br> <dtml-var "t1[2].orderdetid" html_quote> <dtml-var "t1[2].engname" html_quote><br> <dtml-var "t1[1].orderdetid" html_quote> <dtml-var "t1[1].engname" html_quote><br> <dtml-var "t1[5].orderdetid" html_quote> <dtml-var "t1[5].engname" html_quote><br> </dtml-with> you will, of course need to substitute your own query and column names ----- Original Message ----- From: Carlson, Christopher W. <Christopher.W.Carlson@ct.sgcna.com> To: <zope@zope.org> Sent: Thursday, February 24, 2000 4:05 PM Subject: RE: [Zope] ZSQL Method Question This wasn't originally my line of questioning, but it inspired me...and I subsequently became stuck. I've done the following: <dtml-call "REQUEST.set('rows',MaintNames())"> and successfully set 'rows' to the value returned by the SQL Method MaintNames. I can <dtml-in rows> through the list and do fun stuff. After scouring the documentation, I still can't find how to select the values from an arbitrary row, say row 3 without combining <dtml-in> and <dtml-if> while using the sequence-item value. Is there a more elegant way? --- Chris -----Original Message----- From: Matt Goodall [mailto:mgg@isotek.co.uk] Sent: Wednesday, February 23, 2000 11:09 AM To: Chris Withers Cc: Zope Mailing List Subject: Re: [Zope] ZSQL Method Question Chris Withers wrote: If your SQL Method is called sql_GetAll then you can do something like: <!-- Get the rows --> <dtml-call "REQUEST.set('rows',sql_GetAll())"> <!-- Display the total number of rows --> <dtml-var "_.len(rows)"> <!-- Display the records --> <dtml-in rows> <!-- whatever --> </dtml-in> That way you can unlink the code that writes the hidden form input field from the dtml-in code. HTH. /Matt _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Jim Sanford