Cocoa Core Data - Efficient Related Entities Counts

Posted by Gary on Stack Overflow See other posts from Stack Overflow or by Gary
Published on 2010-05-10T02:08:19Z Indexed on 2010/05/10 2:18 UTC
Read the original article Hit count: 297

I am working on my first iPhone application and I've hit a wall. I'm trying to develop a 'statistics' page for a three entity relationship. My entities are the following:

Department - Name, Address, Building, etc. People - Name, Gender (BOOL), Phone, etc

If I have fetched a specific department how do I filter those results and only return people that are Male (Gender == 0)?

If I do

NSLog(@"%d", [department.people count]);

I get the correct number of people in that department so I know I'm in the neighborhood. I know I could re-fetch and modify the predicate each time but with 20+ stats in my app that seems inefficient. Thanks for any advice!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data