Hi Jeff,of course your sort will fail as returnedEntity doesn't know anything about the attribute sortKey. You have to put the complete key path from returnedEntity to the attribute you want the list to be sorted with:
EOSortOrdering sortBy = new EOSortOrdering(returnedEntity.RELATION_TO_SUB_ENTITY_KEY + "." + subEntity.SORT_KEY_KEY, EOSortOrdering.CompareDescending);
of if you are using Wonder as you noted you could make it with:NSArray<EOSortOrdering> sortByArray = returnedEntity .RELATION_TO_SUB_ENTITY.append(subEntity.SORT_KEY).descs();
Have a look at ERXKey for all sorts of qualifier and sort ordering methods.
jw Am 06.07.2008 um 05:35 schrieb Jeff Schmitz:
Hello,This is really hard to put down succinctly, so I'll try to do it a couple different ways:Is there an easy way to base the sort order of an array entities returned on an attribute of an entity related to each of the returned entities?IOW:startEntity to-many returnedEntity sorted by returnedEntity to- one subEntity.sortKey.Note that the returnedEntity owns, and propogates its primary key to, the subEntity.e.g. This was basically my first try (I'm using wonder), but since I was applying a subEntity sort key on a returnedEntity array, it of course choked.EOSortOrdering[] sortBy = { new EOSortOrdering(subEntity.SORT_KEY, EOSortOrdering.CompareDescending)}; NSArray<EOSortOrdering> sortByArray = new NSArray<EOSortOrdering>( sortBy); // Sort NSArray<Entry> entities = this.returnedEntity(null, sortByArray, false); Thanks! Jeff _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/werner%40isd.uni-stuttgart.de This email sent to [EMAIL PROTECTED]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
