Hi, A presumably simple question: Is there an easy way to count the number of occurences of a certain meta type in a Catalog? E.g: I want a dtml snippet that outputs: There are 123 DTML Documents in the Catalog. I've browsed the howto's, but didn't find anything like this. Can anybody offer me some assistance? Thanks in advance, Alexander.
On Tue, 27 Jun 2000, Alexander Limi wrote:
Is there an easy way to count the number of occurences of a certain meta type in a Catalog? E.g: I want a dtml snippet that outputs:
Couldn't you do: <dtml-call "REQUEST.set('counter', 0)"> <dtml-in "objectValues('DTML Document')"> <dtml-call "REQUEST.set('counter', counter+1)"> </dtml-in> This folder (<dtml-var title_or_id) has <dtml-var counter> number of objects with the meta type DTML Document.
But that assumes that they are all in the same folder... a ZCatalog query where meta-type = 'DTML Document' followed by a simple sequence-length would get around that. And I think (but dont quote me on this) that a ZCatalog search is quicker than objectValues. ----- Original Message ----- From: "Erik Enge" <erik@src.no> To: "Alexander Limi" <alexander@limi.net> Cc: <zope@zope.org> Sent: Tuesday, June 27, 2000 1:35 PM Subject: Re: [Zope] ZCatalog counting?
On Tue, 27 Jun 2000, Alexander Limi wrote:
Is there an easy way to count the number of occurences of a certain meta type in a Catalog? E.g: I want a dtml snippet that outputs:
Couldn't you do:
<dtml-call "REQUEST.set('counter', 0)">
<dtml-in "objectValues('DTML Document')"> <dtml-call "REQUEST.set('counter', counter+1)"> </dtml-in>
This folder (<dtml-var title_or_id) has <dtml-var counter> number of objects with the meta type DTML Document.
_______________________________________________ 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 (3)
-
Alexander Limi -
Andy McKay -
Erik Enge