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

Schmidt, Allen J. aschmidt@nv.cc.va.us
Tue, 16 Jul 2002 08:19:08 -0400


<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

-----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.

I know about the cool dtml-in variables like
previous-sequence-start-index, next-sequence-size, etc., but I want to
be able to state on my results form "records 21-40 of X shown" - how do
I gracefully get X?  I know I could do a len() of the query, but that
seems like a bad idea because the database would essentially get queried
twice - once to get the len, and once to create the <dtml-in> list. 
Right?  Am I missing something?  Of course I am.  Any help would be much
appreciated.

Yours,
Am



_______________________________________________
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 )