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 14:35:03 -0700
- Thread-topic: Trouble using ANY operator in an NSArrayController search predicate
The "Predicates Programming Guide" has a brief section on arrays and
filters:
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Article
s/pUsing.html#//apple_ref/doc/uid/TP40001794-250409
I agree that this description could be clearer about what exactly comprises
the "left side" of an expression being used in predicate to filter an
NSArray. Furthermore I can certainly see how the "contents" of the array
could be interpreted as a reference to the array itself and not to the
individual items within. (Assuming that my interpretation is in fact
correct).
I'm not sure how the program constructs the current NSPredicate to filter by
course name, but I would expect that the code would look like:
[NSPredicate predicateWithFormat:@"courses.name CONTAINS[cd] %@",
courseName];
wherein courseName is an NSString specifying the full or partial text of the
course name to match.
Greg
On 5/19/06 1:59 PM, "Jim Correia" <email@hidden> wrote:
> On May 19, 2006, at 4:46 PM, Greg Herlihy wrote:
>
>> 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,
>
> Where in the docs could I have learned this from? The exception said
> "The left hand side for an ALL or ANY operator must be either an
> NSArray or an NSSet" and as far as I can tell, it was.
>
> If I drop the ANY from the front, the predicate works as a filter
> predicate, but it isn't doing a contains match, but rather an equals
> - i.e. partial course name matches don't work. Any ideas?
>
> Thanks,
> Jim
_______________________________________________
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