On 1 août 2014, at 16:47, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
On Fri, Aug 1, 2014 at 11:31 AM, Esteban A. Maringolo <emaringolo@gmail.com> wrote: Y asked for the same thing a few days ago in http://forum.world.st/Multiple-sorting-helper-td4770613.html
Something like: sorter := MultipleSortCriteria new add: #lastName; add: [:each | each personalInfo age ] ascending: false. aCollection asSortedCollection: sorter.
Exactly!!! And... what is most important for me, is that to the MultipleSortCriteria I would like to ask #sortBlock :)
To sort a collection with such an object it only has to answer #value:value:, so is there a special reason you want to generate a block from it? Because generating such blocks might be a bit cumbersome and the object already does the job, no?
Thanks Esteban for better explaining what I was looking for ;)
you could add something like: sorter := MultipleSortCriteria new add: #lastName; add: #firstName ascending: false nullsFirst: true. aCollection asSortedCollection: sorter.
Regards!
Esteban A. Maringolo
2014-08-01 2:40 GMT-03:00 Damien Cassou <damien.cassou@gmail.com>:
On Thu, Jul 31, 2014 at 10:50 PM, stepharo <stepharo@free.fr> wrote:
what are you doing?
I think Mariano would like something like this:
persons sorted: #(lastname firstname birthdate) asSortBlock
that would sort by lastname, and if lastnames are equal by firstnames and if both lastnames and firstnames are equal by birthdate.
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill
-- Mariano http://marianopeck.wordpress.com