[Zope] dtml-in and batches

Michel Pelletier michel@digicool.com
Fri, 17 Sep 1999 12:03:53 -0400


> -----Original Message-----
> From: Michel Pelletier 
> Sent: Friday, September 17, 1999 12:00 PM
> To: 'Duncan Booth'; Michel Pelletier
> Cc: 'zope@zope.org'
> Subject: RE: [Zope] dtml-in and batches
> 
> 
> > -----Original Message-----
> > From: Duncan Booth [mailto:duncan@rcp.co.uk]
> > Sent: Friday, September 17, 1999 12:20 PM
> > To: Michel Pelletier
> > Subject: RE: [Zope] dtml-in and batches
> > 
> > > > I may be missing something obvious here, but if I use the 
> > in tag to 
> > > > iterate over a list in several batches, how can I easily work 
> > > > out what 
> > > > *all* the batches are.
> > > 
> > > Get the _.len(ObjectValues(...)) and divide by your batch size.
> > > 
> > > -Michel
> > As I understand it, the last batch can be longer than the 
> batch size, 
> > but this solution won't cope with that.
> 
> No batch will be bigger than the batch size.  If anything, 
> the last batch will be smaller, but it will be the size of 
> the remainder of dividing the total result set length by the 
> batch size.

Of course, this is only if you have 'orphan=0'.  Otherwise the math is
slightly more complex.

There are gobs and gobs of batch processing variables.  They are all
documented in the DTML Guide.

-Michel
 
> -Michel