Re: Sorting Relationed Records
Re: Sorting Relationed Records
- Subject: Re: Sorting Relationed Records
- From: Art Isbell <email@hidden>
- Date: Wed, 21 Jul 2004 14:57:35 -1000
On Jul 21, 2004, at 1:53 PM, A. Uchida wrote:
public class DetailPage extends WOComponent {
protected expence aExpence;
protected bizAction aBizAction;
protected bizAction bBizAction;
protected expence bExpence;
public NSArray sortResult;
public DetailPage(WOContext context) {
super(context);
//sortExpences();
//System.out.println(aBizAction.actionTitle()); <- this also
gets the error.
aBizAction is null in the above constructor, so sortExpences() and
System.out.println(aBizAction.actionTitle()) will both throw a null
pointer exception.
public void setABizAction(bizAction newABizAction) {
aBizAction = newABizAction;
sortExpences() should work here if newABizAction isn't null.
}
public void sortExpences() {
NSArray ep = new NSArray();
ep = aBizAction.expences();
You're unnecessarily creating an NSArray object that is immediately
being dereferenced. You're referencing "ec" only once, so you might
consider eliminating "ec" altogether.
EOSortOrdering so1 =
EOSortOrdering.sortOrderingWithKey("ep_date",
EOSortOrdering.CompareAscending);
EOSortOrdering so2 =
EOSortOrdering.sortOrderingWithKey("ep_Category",
EOSortOrdering.CompareAscending);
NSArray soList = new NSArray(new Object[]{so1, so2});
sortResult = EOSortOrdering.sortedArrayUsingKeyOrderArray(ep,
soList);
The following would work:
sortResult =
EOSortOrdering.sortedArrayUsingKeyOrderArray(aBizAction.expences(),
soList);
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.