Lets say I have fetched all objects from my store with entity Event which match event names 'Party'. Lets say I got 10 results and out of these 10 results 4 have an entity object of type People with name 'John' and 3 have People objects with name 'Mary' and 3 have both, at the relationship end. I want to query the fetch results array as to how many objects of Event Party have John in them. How do I do that?
I am doing this so that I can show a pie chart of all events sliced by people name.
Should I be doing a predicate search on the Events Array and then find out the count of each or is there a simpler way.
My model is too complex for me to handle the various pie chart scenarios by code.
I know I can use the MoC's
- (NSUInteger)countForFetchRequest:(NSFetchRequest *)request
error:(NSError **)errorbut that will query the store again. And I already have fetched results in my hand that can be overviewd in a pie chart in various ways (like show a pie chart based on events for all the people fetched in the same result).
So if a user chooses to fetch all entries that match event 'party' and event 'treat' AND all those that also have People 'Person 1' and 'person 2', they can view the pie chart with slices of any one of these entites (event or people) with respect to the total count of the other entity.
Thanks.