AND NSPedicate on Core Data relationships

Posted by jesse001 on Stack Overflow See other posts from Stack Overflow or by jesse001
Published on 2010-05-25T12:16:03Z Indexed on 2010/05/25 12:21 UTC
Read the original article Hit count: 158

Filed under:
|
|
|

I'm having trouble compounding NSPredicate with AND, although using OR works fine.

Imagine 2 entities, Doctor and Patient. Doctors can have many patients and patients many doctors. I want to find doctors that, say, have both person1 and person2 as patients. I expected this to work but it returns none.

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY patients matches 'person1&&person2'"];

If I change && to ||, I get all doctors that have person1 or person2 as I'd expect.

Thanks in advance for your help.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about data