Greetings,

I have a collection of Transaction objects.  They have instance variables of 
category and payee.

A category might be “Office Expense”  and a payee might be “Costco” or “Amazon”.

I want to sort by categories and then payees.

Office Expense, Amazon…..
…..
….
….
Office Expense, Costco
….
…
…

Here is some of my code:



sorted := trans asSortedCollection:  [:a :b | (a category) < (b category)].

sorted do:  [ :tr |  | cat pay |
              cat := tr category.
              pay := tr payee.
        
              stream nextPutAll: (tr myPrintFormat2).



How do I make the sort block sort on both keys?

Sincerely,

Joe.





_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to