On 12/07/2010, at 04:34, Giannandrea Castaldi wrote:

> I've also looked for a solution with NSExpression and NSPredicate with
> the function min/max but if I've correctly understood the use of
> NSExpression and NSPredicate with such functions is only for CoreData.
> Thanks.


See the "Set and Array Operators" inside the "Key-Value Coding Programming 
Guide". Example : 

@max

The @max operator compares the objects returned by sending valueForKeyPath: to 
each item in the receiver array passing the key path to the right of the array 
operator as the parameter, returning the maximum value found. The maximum value 
is determined using the compare: method of the objects at the specified key 
path. The compared property objects must support comparison with each other.

The following example returns the date of the latest transaction in the savings 
account:

[savingsAccount valueForKeyPath:@"transactio...@max.date"]


:: marcelo.alves
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to