Reputation: 411
I'm trying the following comparison but it does not work.
What is the appropriate syntax to use both the or/and operator within the same context?
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"((day || day2 ==%@) && CourseTitle==%@)",day,courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];
Upvotes: 0
Views: 62
Reputation: 21593
Try:
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"(((day == %@) OR (day2 == %@)) && CourseTitle==%@)",day, day, courseSelected];
rows = [[courseArray filteredArrayUsingPredicate:predicate]retain];
Upvotes: 4