View Full Version : Using ANY with multiple tests on a single object in an NSPredicate

Jun 7, 2009, 09:10 AM
I have an NSPredicate to process a managed object with several children objects and I want to test multiple properties of each individual child object and test whether any objects exist with both properties.

i.e. I want to make the following code parsable by NSPredicate:

ANY subfeat CONTAINS (feat.miscUse==\"Conscious for Negative HP\" AND active == 1))There is more stuff before the ANY so ideally I don't want to have to break the tests out into two bits - though if this can't be done I guess I'll have to do that.

Another way of looking at this problem with the "Joins" example here (http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/Predicates/Articles/pUsing.html#//apple_ref/doc/uid/TP40001794) would be to get every employee whose name starts with Matt and with any directreport.paygrade that is less than 7 and is also directreport.important.