Re: [Zope] ZCatalog counting?
On Tue, 27 Jun 2000, Steve Spicklemire wrote: > OK.. how about one more little special case > > There are > > > > 0 > > items of type Folder. Um...yep. Just actually looked at my code, and I do indeed have that special case in my working code . That probably makes the set/len code the less complex of the two. --RDM ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] ZCatalog counting?
OK.. how about one more little special case There are 0 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? > > <-- the results' length --> > Hmm. That wasn't my code. I'd suggest instead (untested, but I've used similar code in my own products): There are items of type Folder. 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 - [EMAIL PROTECTED] 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 ) ___ Zope maillist - [EMAIL PROTECTED] 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 )
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: > > > > > > > >This folder ( >number of objects with the meta type DTML Document. um, not to be nitpicking, but if you'd want to know the number of objects with a certain meta-type in a folder, the following is a bit shorter and saves you an iteration: This folder ( number of objects with the meta type DTML Document. This folder ( number of objects with the meta type DTML Document. not entirely sure of the dtml-let syntax, but you get the idea Rik ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] ZCatalog counting?
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? > > <-- the results' length --> > Hmm. That wasn't my code. I'd suggest instead (untested, but I've used similar code in my own products): There are items of type Folder. 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 - [EMAIL PROTECTED] 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 )
Re: [Zope] ZCatalog counting?
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" <[EMAIL PROTECTED]> To: "Alexander Limi" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> 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: > > > > > > > > This folder ( > number of objects with the meta type DTML Document. > > > > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 ) > ___ Zope maillist - [EMAIL PROTECTED] 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 )
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: This folder ( number of objects with the meta type DTML Document. ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] ZCatalog counting?
>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? > > 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? <-- the results' length --> Also at the zdp site: http://zdp.zope.org/projects/zsnippet/snippets/DTMLContent/CatalogResLength Rik ___ Zope maillist - [EMAIL PROTECTED] 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 )