I have an object "Internet_Ticket" and every Instance from the object has a id. <dtml-in "object.Values(['Internet_Ticket']) " sort=id> but if i show the objects there is a strange sequence. 1 10 100 101 102 103 .... 109 11 110 ..... It seems its a binary sequence. Why is it and how can i change it ? 1 2 3 4 5 .... 10 11 12 .... Thanks in advance for any advice. Regards Klaus -- ewt gmbh data management group tel: ++49 821 3106 319 fax: ++49 821 3106 399 url: www.ewt.de
On Fri, Apr 19, 2002 at 03:49:19PM +0200, Klaus Boehm wrote:
I have an object "Internet_Ticket" and every Instance from the object has a id.
<dtml-in "object.Values(['Internet_Ticket']) " sort=id>
but if i show the objects there is a strange sequence.
1 10 100 101 102 103 .... 109 11 110 .....
It seems its a binary sequence.
No, it is lexicography (string) order. To sort, you want convert IDs from strings to ints. Write a simple Python Script: # Python Script; id: cmp_int; params: id1, id2 return cmp(int(id1), int(id2)) and sort by the function: <dtml-in "object.Values(['Internet_Ticket'])" sort="id/cmp_int"> Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
This is standard ordening for a computer: 1 10 ... 109 11 ... try this instead 001 002 ... 010 011 ... 100 ... logic is a strange factor :-)
-----Oorspronkelijk bericht----- Van: zope-admin@zope.org [mailto:zope-admin@zope.org]Namens Klaus Boehm Verzonden: vrijdag 19 april 2002 15:49 Aan: zope-request@zope.org Onderwerp: [Zope] sort problem
I have an object "Internet_Ticket" and every Instance from the object has a id.
<dtml-in "object.Values(['Internet_Ticket']) " sort=id>
but if i show the objects there is a strange sequence.
1 10 100 101 102 103 .... 109 11 110 .....
It seems its a binary sequence.
Why is it and how can i change it ?
1 2 3 4 5 .... 10 11 12 ....
Thanks in advance for any advice.
Regards
Klaus
--
ewt gmbh data management group tel: ++49 821 3106 319 fax: ++49 821 3106 399 url: www.ewt.de
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Klaus Boehm -
Oleg Broytmann -
Roel Van den Bergh