[Zope] total "hits" in dtml-in?

Chris Meyers chris@hddesign.com
Tue, 16 Jul 2002 08:11:20 -0500


On Tue, Jul 16, 2002 at 08:44:47AM -0400, A M Thomas wrote:
> Thanks!  That does work.
> 
> It would be nice to have one just for the total number of hits, but I
> can understand not wanting to clutter up the language.
> 
> - Am
> 
> Schmidt, Allen J. wrote:
> > 
> > <dtml-in mysqlmethod>
> >  <dtml-if sequence-start>
> >   Total Records: <dtml-var count-MyVarName>
> >  </dtml-if>
> >  Current Value: <dtml-var MyVarName>
> > </dtml-in>
> > 
> > Basically, just add 'count-' to a variable to count. This gives the count
> > all the records in the result set.
> > 
> > -Allen

You need to be careful with this though because ZSQL methods have a limit to the number of records returned at one time. The default is 1000 so you may not ever have a problem with this, but you could. If your count variable returns 1000 you're probably running into the limit rather than getting the actual count. You can change the ZSQL limit in the properties tab of the ZSQL Method.

Chris

> > 
> > -----Original Message-----
> > From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of A M
> > Thomas
> > Sent: Tuesday, July 16, 2002 8:00 AM
> > To: zope@zope.org
> > Subject: [Zope] total "hits" in dtml-in?
> > 
> > Hello,
> > 
> > I've just put together my first Zope/MySQL database search interface.
> > Gosh that's cool.  However, I have a question. Obviously.
> > 
> > How can I get the _total_ number of returned results for a <dtml-in>
> > statement (not the number in the current batch)?  This is probably so
> > obvious that it's staring me in the face, but I can't find it anywhere.
> > I even tried (quickly) perusing some source code, but maybe I was
> > looking in the wrong place.  My main reference has been the Zope book,
> > another Zope book, and searching the web site.
> 
> 
> 
> _______________________________________________
> 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 )

-- 
Chris Meyers
Huttleston Data Design
7941 Tree Lane Suite 200
Madison WI 53717