[Zope] Sort by property, then match all docs w/property

cgreen cgreen@ttsg.com
Wed, 09 Jan 2002 17:38:55 -0500


--------------050003080809010502030509
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------050003080809010502030509
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<html><head></head><body>First, I apologize in advance: this is more a minor syntax problem than anything else,
<br>
and a combination of my laziness and incompetence at basic programming ("I'm a SysAdmin,
<br>
not a <b class="moz-txt-star"><span class="moz-txt-tag">*</span>programmer<span class="moz-txt-tag">*</span></b>!!")
<br>
<br>
I have modified Tres Seaver's STX_Document product to include a property "topic".
<br>
I have figured out how (stolen the code) to sort all the 'STX_Document's within a folder,
<br>
sorting all documents by property and arranging them in a table.
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;dtml-in expr="_.sequence.sort(PARENTS[0].objectValues(['STX_Document']),
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;quot;&lt;dtml-var description&gt;&amp;quot;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

<br>
What I'd like to do next is grab each property in a variable to compare against the value
<br>
of the <b class="moz-txt-star"><span class="moz-txt-tag">*</span>next<span class="moz-txt-tag">*</span></b> 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.
<br>
<br>
I <b class="moz-txt-star"><span class="moz-txt-tag">*</span>realize<span class="moz-txt-tag">*</span></b> this a basic department sort/subtotal algorithm, but I don't have the familiarity
<br>
with Zope syntax to work it out, and deadlines lay poised like a gun pressed against my temple.
<br>
<br>
Any tips, clues, helpful hints or seeing-eye dog coupons will be gratefully appreciated....
<br>
<br>
peace
<br>
</body></html>
--------------050003080809010502030509--