Ted Vinke wrote:

> hopefully somebody can help my out ordering the following properly. I
> have and INCIDENT (a problem) related to INCIDENTSTATUS (New, Open,
> Accepted, etc.)
> 
> INCIDENT      TIMEREL         INCIDENTSTATUS
> ---------  -->        ------- -->     --------------
> title         date            title ("New", "Open", etc.)
> desc                          sortorder (integer such as 5, 10...)

You could have used resourcebundles or so for the sortorder field. (i suspect there is 
a limited
number of statuses?)

> Everytime the status of an incident changes a new timerel relation is
> created with the appropriate incidentstatus. The problem occurs when I
> need to display a list of incidents
> 
> 1) with their last related status (via timerel date-field)
> 2) ordered by the incidentstatus sortorder-field, so I get all the New
> incidents on top of the list, all Rejected items on the bottom, etc.
> 
> The problems lies in the fact that I need the list to retrieve FIRST the
> most recent related incidentstatus and THEN order the whole list by the
> sortorder-field of each last related status.
> 
> The following construction just doesn't do both, it doesn't take the
> date field of the timerel into account.
> 
> <mm:listnodes type="incident">
>       <c:set var="node"><mm:field name="number"/></c:set>
>       <mm:relatednodescontainer path="incidentstatus" 
>       searchdirs="destination">
>               <mm:sortorder field="sortorder" direction="up" />
>               <mm:maxnumber value="1" />
>               <mm:relatednodes>
>                       <-- show incident node number-->
>                       <mm:field name="${node}" />

Very odd code, you display a field of which the name is a another nodes' number?

Btw, why would you not use the 'node' attribute to simply the code?

>               </mm:relatednodes>
>       </mm:relatednodescontainer>
> </mm:listnodes>



> Is there a way to use the sortorder-field of the most recent timerel to
> order the entire list of incidents?


What's wrong with:
<mm:listnodes type="incident" id="incident">
<mm:relatednodescontainer role="timerel" type="incidentstatus">
  <mm:sortorder field="timerel.date" />
  <mm:sortorder field="sortorder" />
  <mm:maxnumber value="1" />
  <mm:relatednodes>
     <mm:field node="incident" name="title" />
  </mm:relatenodes>
</mm:relatednodescontainer>
</mm:listnodes>

Or so. This would firstly order on date, then on sortorder, and leaves only one.


-- 
Michiel Meeuwissen                  mihxil'
Mediacentrum 140 H'sum                [] ()
+31 (0)35 6772979         nl_NL eo_XX en_US




Reply via email to