Re: Trouble using ANY operator in an NSArrayController search predicate
Re: Trouble using ANY operator in an NSArrayController search predicate
- Subject: Re: Trouble using ANY operator in an NSArrayController search predicate
- From: Greg Herlihy <email@hidden>
- Date: Fri, 19 May 2006 13:46:11 -0700
- Thread-topic: Trouble using ANY operator in an NSArrayController search predicate
Remove the "ANY" from the search filter predicate. A filtering predicate is
applied to each item individually in order to determine whether the item
should be filtered out.
Greg
On 5/19/06 8:19 AM, "Jim Correia" <email@hidden> wrote:
> Assuming the following entities
>
> Course
> name
> students
>
> Student
> name
> courses
>
> and the automatically generated UI in IB.
>
> I've added an additional predicate to the search field
>
> ANY courses.name CONTAINS[cd] $value
>
> A predicate of this form works correctly[1] when executed directly
> against a MOC. However, when the search field applies it as the
> filterPredicate, the following exception is raised.
>
> The left hand side for an ALL or ANY operator must be either an
> NSArray or an NSSet.
>
> #0 0x90a4c4d8 in objc_exception_throw
> #1 0x92adecec in -[NSPredicateOperator
> performOperationUsingObject:andObject:]
> #2 0x92adae08 in -[NSComparisonPredicate
> evaluateWithObject:variableBindings:]
> #3 0x92adc37c in -[NSPredicate evaluateWithObject:]
>
> What am I doing wrong?
>
> How do I filter by "student is enrolled in one or more courses whose
> name contains "physics"?
>
> Thanks,
> Jim
>
> [1] Subject to the constraints of a bug which isn't relevant here.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden