I have an NSArrayController, companiesController bound to a top level Core Data entity, Companies.
A Company has many Department‘s, and a Department has many Employee; these are represented by the 1-to-many relationships, departments and employees.
Based on the attribute salary of an Employee I thought I could dynamically do this for filtering based on salary inside a UI-called method:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY departments.employees.salary < %@", [NSNumber numberWithInt:23000]];
[companiesController setFilterPredicate:predicate];
Alas, this gives me the error: -[NSCFSet compare:]: unrecognized selector sent to instance.
Multiple to-many keys are not allowed in this case.
Instead, you could do the following:
Code changes (step 3):
And the new method (step 2):