[Zope] Help! Sorting on a numeric id?
Mats Nordgren
mats@ronin-group.org
Thu, 13 Dec 2001 12:41:05 -0800 (PST)
That took care of the problem, thanks for you help :)
Mats
--- Oleg Broytmann <phd@phd.pp.ru> wrote:
> On Wed, Dec 12, 2001 at 06:58:26PM -0800, Mats
> Nordgren wrote:
> > How do i sort on numeric id?
> >
> > I have a Folder containing Zclasses with numeric
> ids.
> > what i am trying to do is to sort it, but it
> treats
> > the ids as strings as it should, how do i sort it
> so
> > it treats the ids as numeric values?
> >
> > <dtml-in "objectValues(['ZClass'])" sort=id>
> > <dtml-var id>
> > </dtml-in>
> >
> > Produces:
> > 1
> > 10
>
> In the ZClass create a method, say "num_id", that
> will return numeric
> id. Something like "return int(self.id)". Sort by
> the method.
>
> <dtml-in "objectValues(['ZClass'])" sort=num_id> or
> <dtml-in "objectValues(['ZClass'])"
> expr_sort=num_id>.
>
> Oleg.
> --
> Oleg Broytmann http://phd.pp.ru/
> phd@phd.pp.ru
> Programmers don't die, they just GOSUB
> without RETURN.
>
>
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com