Reputation: 77661
I have a model with a couple of to-many relationships.
System ->> Item ->> Code
I'm trying to write a predicate on a fetchRequest for System.
I only want to show Systems that have Items that have at least one Code.
I have tried a SUBQUERY but I just can't get it to work.
This is what I've tried...
[NSPredicate predicateWithFormat:@"(SUBQUERY(items, $x, $x.codes.@count != 0) != 0)"];
I've tried other various permutations of this but they all throw similar errors.
Could someone let me know what the correct predicate format is?
Upvotes: 0
Views: 119
Reputation: 540065
I think you have to add another @count
for the SUBQUERY:
[NSPredicate predicateWithFormat:@"SUBQUERY(items, $x, $x.codes.@count != 0).@count != 0"];
Upvotes: 0