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: Jim Correia <email@hidden>
- Date: Mon, 22 May 2006 14:59:16 -0400
On May 20, 2006, at 10:09 AM, Michael Tsai wrote:
On Saturday, May 20, 2006 8:02:59 AM Jim Correia
<email@hidden>
wrote:
In the operations section of the doc, it says:
CONTAINS and IN serve both as aggregate operators and string
operators, depending on the types of their arguments.
[...]
If you look at the operator type constants rather than the format
string
grammar, you'll see that CONTAINS compiles down to IN with the LHS and
RHS swapped. And IN combined with ANY behaves as documented (LHS
must be
a collection), which is to say that they won't do what you want.
Thanks Michael. This is the key piece that I overlooked.
ANY array_expression CONTAINS[cd] string_expression
compiles to
ANY string_expression IN[cd] array_expression
which is obviously wrong and explains the exception "The left hand
side for an ALL or ANY operator must be either an NSArray or an NSSet."
(i.e. the LHS of the compiled predicate, not of the format string
that I supplied.)
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