1

Is there a way to simulate the Sub Select Methods without pulling out the whole set that you want to limit against.

In this question Core Data: Query objectIDs in a predicate?

they gave a demonstration of using the not in limit. But it shows using a list of objects that you would want to limit against.

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT (self IN %@)", arrayOfExcludedObjects];

Is this the only way to do this or is there a way to limit against a sub query so I dont have to get the results of a query I want to limit against.

Community
  • 1
  • 1
The Lazy Coder
  • 11,560
  • 4
  • 51
  • 69

1 Answers1

2

As it turns out there does not appear to be a way to do a join in CoreData.

I could potentially open the SQLite database up manually and join the data to get the results I was looking for, But I would lose the power of core data if I went that route.

It seems the best way to accomplish this is to run the query I want and get back the objects that I want limited out, and put those into the arrayOfExcludedObjects. Alternatively I can add the objects I want to keep to an array and add a predicate with "(self IN %@)" and it would accomplish the same thing.

The extra functionality I gain with core data occasionally gives a loss of other functionality.

Perhaps someday apple will add those types of predicates.

The Lazy Coder
  • 11,560
  • 4
  • 51
  • 69