Philip Aylesworth writes:
 > I am trying to get a list of unique values for one particular meta_type.
 > The uniqueValuesFor() works great but is there a way to get unique
 > values for a subset of data such as meta_type='car' then
 > uniqueValuesFor('make') would list the makes of cars but not of
 > toasters?
The "uniqueValuesFor" is an artifact of the way indexes are
implemented: a mappings. They map index terms to lists of
objects indexed under the corresponding term.
Most mappings have a "keys()" method. It gives the
"uniqueValuesFor".

That said, if you want to have "uniqueValuesFor" a subset
of the catalog, you cannot use this "keys()" method.
You must do it yourself:

  Select the objects you want, build a dictionary mapping
  the attribute you are interested in to something (say 1)
  and use the "keys()" method of this dict.

  Something like 3 to 5 lines in a PythonScript.


Dieter

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

Reply via email to