views:

31

answers:

0

I have two entities: Department and DepartmentInfo. Every Department has one or many DepartmentInfo Objects. Inside DepartmentInfo, there is an departmentName attribute.

I want to fetch all those Department objects which have a specific departmentName. So I make an NSFetchRequest for the Department entity, and use this fetch request:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(departmentName, $s, $s.departmentName LIKE[c] %@).@count > 0", @"Marketing"];

It works, BUT: The LIKE[c] doesn't! I must match against the exact department name. If I do this, I will get no match:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(departmentName, $s, $s.departmentName LIKE[c] %@).@count > 0", @"Mar"];

What could be wrong here?