[Zope-DB] ZPT SQL newbie question

Ray Kimsey Ray_Kimsey at ncsu.edu
Thu Sep 18 19:56:23 EDT 2003


I have two questions that I expect are fairly simple to resolve, but all 
my searches have not ended in a solution. If you can point me in the 
right direction I would be most appreciative.

I have a SQL table similar to following:

focus_area_title   objective_text   initiative
----------------------------------------------
Focus Area 1      Objective 1 text      ssf
Focus Area 2      Objective 2 text      ssf
Focus Area 2      Objective 3 text      ssf
Focus Area 3      Objective 4 text      dry

I have the following code:

<table cellpadding="10" border="0">
  <tr tal:repeat="list 
python:container['sel_fa_by_initiative'](initiative='ssf')">
    <td tal:attributes="bgcolor python:test(path('repeat/list/even'), 
'#F3F3F3', '#FFFFFF')">
      <p class="content_b" tal:content="list/title">Focus Area</p>
      <p class="content_p" tal:content="list/objective">Objective 
text.</p></td>
  </tr>
</table>


that yields something like the following:

    Focus Area 1
        Objective 1 text

    Focus Area  2
        Objective 2 text

    Focus Area 2
        Objective 3 text


What I really want is:


    Focus Area 1
        Objective 1 text

    Focus Area  2
        Objective 2 text
        Objective 3 text

Does anyone know how to achieve this sort of  "group by" effect ?

Part two is how to set the initiative argument to the ZSQL method  
(above it is hard coded to 'ssf') to the string value of  here/id.


Thanks in advance for any help you can give.

Ray Kimsey
NC State University





More information about the Zope-DB mailing list