Say we have A <–>> B <–>> C. We have multiple A entities, and C entities have an attribute called label. How can I find all A entities that contain C entities that contain @”1234″?
I saw this SUBQUERY in core data and it works great, but I’m basically trying to go one level deeper.
How could I achieve that?
thank you
The solution to this question was given by Dave DeLong.
I am pasting here the one line of code that shows the subquery that worked for me in case it can help somebody else.
NSPredicate * sp = [NSPredicate predicateWithFormat:@”SUBQUERY(catalogItemClasses, $b, ANY $b.catalogItems.label contains[cd] %@).@count > 0″, searchText];
So here the structure I am dealing with is A <–>> B <–>> C.
B entities are the “catalogItemClass” and C are the “catalogItem” entities.
This allows me to query for A entities that are related to C entities that have labels that contain the string searchText in them.
Thanks Dave.