[Zope] DTML question

Dieter Maurer dieter@handshake.de
Wed, 28 Jun 2000 22:31:13 +0200 (CEST)


Rik Hoekstra writes:
 > 
 > 
 > Luke Tymowski wrote:
 > > 
 > > Hello,
 > > 
 > > I want to retrieve the last 3 filenames from a subfolder and display them in
 > > a document. If I set the size of the retrieval to 1, I get just 1 name
 > > returned. If I set the size to 3, I get everything in the folder. (if I use
 > > 2 I also get everything in the subfolder )
 > > 
 > > Here is my code (using 2.2b2):
 > > 
 > > <dtml-with Document>
 > >   <dtml-in "objectValues(['DTML Document'])" size=3 sort=id>
 > >       <dtml-var id> <dtml-var title><br>
 > >   </dtml-in>
 > > </dtml-with>
 > > 
 > 
 > You could try (untested):
 > 
 > <dtml-with Document>
 >   <dtml-in "objectValues(['DTML Document'])[-3:]" sort=id>
 >       <dtml-var id> <dtml-var title><br>
 >   </dtml-in>
 > </dtml-with>
This will first select 3 elements and only then sort.
Maybe not, what on wants.

<dtml-in "Document.objectValues(['DTML Document'])" sort=id reverse size=3 orphan=0>

may do the trick.



Dieter