[Zope] Count results of ZCatalog query

Max M maxm@mxm.dk
Fri, 14 Jun 2002 12:41:51 +0200


Juergen R. Plasser / Hexagon wrote:

> How can I count the results of a ZCatalog query? This must be a simple 
> thing...
>
> I have tried <dtml-var "_.len(Catalog)"> but with no success. 


The "Catalog" you are refering to is an object not a function that 
returns a result. You can however call it as a function::

    <dtml-call "Catalog(meta_type='Folder')">

and it will return a list of results. You can then take the len() of 
this list.

    <dtml-call "REQUEST.set('searchResult', Catalog(meta_type='Folder'))">
    <dtml-var "_.len(searchResult)">
    <dtml-in searchResult>
    ... etc.
    </dtml-in>

regards Max M


---

"Sorry I would Really Like To Help More On This Project,
But Am To Busy Doing Paid Work On A Tight Deadline"
    Max M