Thanks, I was hoping to avoid that. There are approx 10,000 projects in
our database, only about 200-300 of which haven't been "approved." I'd
rather not fetch 10,000 objects and then fetch another 9,800 to remove
from the original array. But if no one else has an alternative, I guess
that will be the way to go. Thanks.
Joe
>>I'm trying to use the EOM Qualifier Builder to construct a Fetch Spec
>>which needs to query across a to-many relationship specifically for the
>>case where there are no destination objects.
>>
>>Say I have two tables: Project and Milestone. There are a variable number
>>of milestones for each project so there is a to-many relationship:
>>Project <--->> Milestone. The first milestone is "approval." It is easy
>>enough to query on the keypath "toMilestones" to find all projects that
>>have approval dates. However, I need to generate a list of projects that
>>have not yet been approved, and so have no Milestone objects associated
>>with them.
>
>I don't know if this is what you want or even if it's the best way but I had
>a similar issue. I have a list of Customers and a relationship to Users. I
>want two lists; one with the list of customers to which the user has access
>and the other a list of customers to which the user does *not* have access.
>Here's what I did.
>
>NSMutableArray results;
>
> NSMutableArray results;
> EOFetchSpecification fetchSpec;
>
> // get every customer
> fetchSpec = new EOFetchSpecification("Customers", null, null);
> results =
>(NSMutableArray)session().defaultEditingContext().objectsWithFetchSpecificat
>ion(fetchSpec);
>
>// results is every Customer
>// customersArray is all the customers that the user has access to
>NSArray customersArray = new NSArray(selectedUser.customers());
>
>// this is the important bit
> results.removeObjectsInArray(customersArray);
>
>Works for me, hope this helps.
>
>--Marc Respass