Re: CoreData: predicate for empty relationship?
Re: CoreData: predicate for empty relationship?
- Subject: Re: CoreData: predicate for empty relationship?
- From: John Timmer <email@hidden>
- Date: Thu, 17 Nov 2005 10:33:52 -0500
- Thread-topic: CoreData: predicate for empty relationship?
> Say I have a Person entity, with a to-many relationship to pets.
>
> How do I write a predicate which will select all the people who
> currently don't have any pets?
>
> Thanks,
> Jim
Jim -
Don't know if this got answered (I've been way too busy of late to follow
the list that carefully), but wouldn't the following work:
NSPredicate *thePredicate = [NSPredicate predicateWithFormat:
@"pets.@count == 0"];
Then just look for persons where that's true.
JT
_______________________________________________
This mind intentionally left blank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden