I have 2 entities in a to-many relationship, Parent-->Child. The Child entity has an boolean attribute which can be TRUE or FALSE.

I can easily count how many child entities there are with `[parent.child count]`, which returns a nice integer for me.

But what if I only want to count the child entities that are TRUE? Is there an easy way to do this?

---

**EDIT**
--------

I've tried to implement @unforgiven's predicate selection, but I'm getting an 'unable to parse the format string' error - this is the code I'm trying (where `Checklist` is the parent entity, `ChecklistItem` is the child entity, and `checked` is the bool value for the ChecklistItem):

```
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    Checklist *aChecklist = [self.fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = aChecklist.name;

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Checklist" inManagedObjectContext:self.managedObjectContext];
    [fetchRequest setEntity:entity];

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(checklistItem, $sub, $sub.checked == %@).@count", [NSNumber numberWithBool:YES]];
    [fetchRequest setPredicate:predicate];

    NSError *error = nil;
    NSArray *results = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];

    cell.detailTextLabel.text = [NSString stringWithFormat:@"%i items ticked", [results count]];
    [fetchRequest release];
}

```

If I replace the predicate with `any self.checklistItems.checked = %@` the the app doesn't crash, but the number returned is *the total number of Checklists that have any ChecklistItem checked*, which obviously means it returns the same number for every checklist.