Hi Frank,

You wrote

Hi Bill,

I tried using predicates for this but did not succeed.
What would a predicate look like which finds the object of an entity with the maximum value for a property?

I haven't done exactly what you want but if you have an object that has a to many relationship to all the entities over which you want to search, you can first do this

    NSNumber * theMax =  [someObject valueForKeyPath: @"[EMAIL PROTECTED]"];

Then build a fetchRequest using theMax.

If you don't have such an object, I think you'll have to load at least faults for all your objects into memory and then do

     NSNumber * theMax =  [objects valueForKeyPath: 
@"@max.attributeYouWantMaxOf"];

Then do the fetchRequest. I think I remember reading somewhere that @max doesn't cause faults to fire.

There is likely a better way but that might get you going without too much trouble...

Cheers,

Steve

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to