• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sorting Relationed Records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Sorting Relationed Records
      • From: "A. Uchida" <email@hidden>
References: 
 >Sorting Relationed Records (From: "A. Uchida" <email@hidden>)
 >Re: Sorting Relationed Records (From: Nathan Dumar <email@hidden>)
 >Re: Sorting Relationed Records (From: "A. Uchida" <email@hidden>)
 >Re: Sorting Relationed Records (From: Nathan Dumar <email@hidden>)
 >Re: Sorting Relationed Records (From: "A. Uchida" <email@hidden>)

  • Prev by Date: Re: Duplicate record
  • Next by Date: Re: Are Apple's Java docs any good?
  • Previous by thread: Re: Sorting Relationed Records
  • Next by thread: Re: Sorting Relationed Records
  • Index(es):
    • Date
    • Thread