Using ANY with multiple tests on a single object in an NSPredicate

Discussion in 'Mac Programming' started by Eraserhead, Jun 7, 2009.

  1. Eraserhead macrumors G4


    Nov 3, 2005
    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 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.

Share This Page