• 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
EOSortOrdering based on a @count relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOSortOrdering based on a @count relationship


  • Subject: EOSortOrdering based on a @count relationship
  • From: Dev WO <email@hidden>
  • Date: Tue, 9 Jan 2007 00:51:18 +0100

Hi,
I've been trying to isolate the issue with this, but I just can't even get an error...
So I need to sort based on a calculated attribute: relationship ().count()


but I just can't make it work...

I've got entity "a" which has a toMany relationship "relationship()".
I need to sort "a" entities based on relationship().count().

So here's my SortOrder:
--------
    public Number numberOfComments() {
    	return (Number)writeCommentaries().count();
    }

public NSArray sortOrderingByCommentaries() {
NSMutableArray sortOrdering = new NSMutableArray();
EOSortOrdering newSO = EOSortOrdering.sortOrderingWithKey ("numberOfComments", EOSortOrdering.CompareDescending);
sortOrdering.addObject(newSO);
return (NSArray)sortOrdering;
}
--------


and the actual sorted array:
--------
public NSArray listOfNewsSortedByCommentaries() {
return (NSArray)EOSortOrdering.sortedArrayUsingKeyOrderArray (listOfNews(), new NSArray(sortOrderingByCommentaries()));
}
--------


but it won't work, I don't even get a crash, just a "no instance available"...
I tried with another Number attribute to see if it coud be the cause, but it works. I also sort using another attribute and display the relationship().count() for each "a" and it works. It seems I just can't sort using the relationship().count().


But I though I could use custom attribute as long as the array is already in an editing context.

I must miss something, but I can't find it...

Thanks for your help

Xavier

_______________________________________________
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


  • Follow-Ups:
    • Re: EOSortOrdering based on a @count relationship
      • From: Lachlan Deck <email@hidden>
    • Re: EOSortOrdering based on a @count relationship
      • From: Ian Joyner <email@hidden>
  • Prev by Date: WebObjects vs J2EE?
  • Next by Date: Re: EOSortOrdering based on a @count relationship
  • Previous by thread: Re: WebObjects vs J2EE?
  • Next by thread: Re: EOSortOrdering based on a @count relationship
  • Index(es):
    • Date
    • Thread