Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding the largest value in an NSTreeController?




On May 31, 2008, at 12:05:58, I. Savant wrote:

1 - Create a fetch request for your desired entity.
2 - Create a sort descriptor for the key whose max value you're interested in.
3 - Set the fetch request's sort descriptor to the above.
4 - Create any predicates needed for filtration (ie, whatever you may or may not have used in the tree controller).
5 - Set the fetch request's predicate to the above if any.
6 - Execute the fetch request and get the last (or first) object of the results (checking for errors, minding the set-versus-array gotchas, etc.).


Wow, really? No way to just get at all the items in the tree controller with some key path, then use @max? It seems that this would be possible with an NSArray:

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html#/ /apple_ref/doc/uid/20002176

TIA,

--
Rick

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Finding the largest value in an NSTreeController? (From: Rick Mann <email@hidden>)
 >Re: Finding the largest value in an NSTreeController? (From: Jonathan Dann <email@hidden>)
 >Re: Finding the largest value in an NSTreeController? (From: Rick Mann <email@hidden>)
 >Re: Finding the largest value in an NSTreeController? (From: "I. Savant" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.