[Zope] Sort by property, then search for matches

cgreen cgreen@ttsg.com
Wed, 09 Jan 2002 12:16:53 -0500


First, I apologize in advance: this is more a minor syntax problem than anything else,
and a combination of my laziness and incompetence at basic programming ("I'm a SysAdmin,
not a *programmer*!!")

I have modified Tres Seaver's STX_Document product to include a property "topic".
I have figured out how (stolen the code) to sort all the 'STX_Document's within a folder,
sorting all documents by property and arranging them in a table.


     <dtml-in expr="_.sequence.sort(PARENTS[0].objectValues(['STX_Document']),
                                       (('topic', 'nocase'),
					 ('title','cmp'),
                                       ))">
			  

          <th><dtml-var topic></th> <td><a href="<dtml-var URL1>/<dtml-var id>">
                                <dtml-var title> 
				&quot;<dtml-var description>&quot;
                                

 What I'd like to do next is grab each property in a variable to compare against the value
of the *next* iteration. If it matches, don't print the topic name in the table header. If 
it doesn't match, print the topic name and set the temp variable to the new value.

I *realize* this a basic department sort/subtotal algorithm, but I don't have the familiarity
with Zope syntax to work it out, and deadlines lay poised like a gun pressed against my temple.

Any tips, clues, helpful hints or seeing-eye dog coupons will be gratefully appreciated....

peace