[Zope] Newby question: Finding unique values from a ZCatalog, matching a criteria

Dianne Van Dulken Dianne.VanDulken@team.ozemail.com.au
Tue, 12 Mar 2002 12:04:31 +1100


Hi, 

This is probably going to be a laughably easy question for most of you, but
it is confusing me no end.  I have a ZCatalog set up for a list of
merchants.  They can be active, inactive or pending.  The merchant name
isn't unique, as there can be one merchant in books, same one in DVDs, etc.

What I am trying to do is to return a unique list of all merchants who are
active.

If I use 

<dtml-in "CatalogMerCat(sort_by='merchant', status='Active')">

I get all active ones, but are getting Merchant1, Merchant1, Merchant2, etc.

If I use

<dtml-in "CatalogMerCat.uniqueValuesFor('merchant')">

I am getting Merchant1, Merchant2, etc, whether they are active or not.

I tried one after the other, but the outer one is the only one returned.  I
also tried

<dtml-in "CatalogMerCat.uniqueValuesFor('merchant'),status='Active'"> (and
various different location for the status), but it keeps on giving me an
error.

Could anyone suggest what I ought to be doing?  It seems like such an easy
thing to do, but I just can't work out what I should be doing.

Cheers

Di