Let's say I have basic data objects of type "obj" that have a property of "propertyA" and a one-to-many relationship with an object of type "sub" that has two properties: "propertyB" and "propertyC".
I want to get all objects that have property A equal to the value, and sub obj with property B and a set of properties.
If it were just property A and property B, I would do
[NSPredicate predicateWithFormat:@"ANY sub.propertyB = %@ AND propertyA == %@", ...];
The problem is that I cannot figure out how to add to the second property. I want only those objects that have at least one sub element that has two true properties. I tried the following, but it does not work:
[NSPredicate predicateWithFormat:@"ANY (sub.propertyB = %@ AND sub.propertyC) AND propertyA == %@", ...];
I tried this without ANYTHING, but this also doesn't work. How can i do this?
source
share