Re: Sorting Question
Re: Sorting Question
- Subject: Re: Sorting Question
- From: Ken Anderson <email@hidden>
- Date: Sun, 20 Feb 2005 16:18:57 -0500
Try using mutableCopy() on those arrays before mushing them together...
On Feb 20, 2005, at 4:14 PM, James Cicenia wrote:
Hello -
I am trying to sort dates ascending.. but with nulls coming at the
bottom.
So this is my code:
EOSortOrdering dateOrdering1 =
EOSortOrdering.sortOrderingWithKey("requestedDueDate",
EOSortOrdering.CompareAscending);
EOSortOrdering dateOrdering2 =
EOSortOrdering.sortOrderingWithKey("submittedDate",
EOSortOrdering.CompareAscending);
NSMutableArray myOrdering = new NSMutableArray();
myOrdering.addObject(dateOrdering1);
myOrdering.addObject(dateOrdering2);
EOQualifier myQualifier2;
myQualifier2 =
EOQualifier.qualifierWithQualifierFormat("requestedDueDate != null",
null);
EOQualifier myQualifier3;
myQualifier3 =
EOQualifier.qualifierWithQualifierFormat("requestedDueDate = null",
null);
NSMutableArray results1 =
(NSMutableArray)EOQualifier.filteredArrayWithQualifier(results,
myQualifier2);
NSMutableArray results2 =
(NSMutableArray)EOQualifier.filteredArrayWithQualifier(results,
myQualifier3);
EOSortOrdering.sortArrayUsingKeyOrderArray(results1, myOrdering);
EOSortOrdering.sortArrayUsingKeyOrderArray(results2, myOrdering);
results1.addObjectsFromArray(results2);
return results1;
It doesn't work though. Results1 by itself is correct. Results2 by
itself is correct.
However when I use the addObjectsFromArray method is seems to be
putting
results2 in front of results1?!
However when I reverse it to results2.addObjectsFromArray(results1);
Results2 doesn't show up?!
Any thoughts?
Thanks,
James Cicenia
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden