[Zope] ZCatalog counting?

Steve Spicklemire steve@spvi.com
Tue, 27 Jun 2000 21:56:00 -0500 (EST)


OK.. how about one more little special case....

There are 
 <dtml-in "Catalog(meta_type="Folder")" size=1>
   <dtml-var sequence-length>
 <dtml-else>
    0
 </dtml-in> 
items of type Folder.

untested of course. ;-)

-steve

RDM wrote:
----------------------------------------------------------------------

On Tue, 27 Jun 2000, Rik Hoekstra wrote:
> To quote a mail by RD Murray from a gew days ago:
> 
>  How do I find the size of the results returned by the catalog?
>  <dtml-let results=Catalog(....)>
>  <dtml-var "_.len(results)"> <-- the results' length -->
>  </dtml-let>

Hmm.  That wasn't my code.  I'd suggest instead (untested, but I've
used similar code in my own products):

<dtml-in "Catalog(meta_type="Folder")" size=1>
  There are <dtml-var sequence-length> items of type Folder.
</dtml-in>

I'm not sure what the relative advantages of these two code
snippets would be, but the latter does stick purely to dtml.

--RDM


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