On Oct 15, 2012, at 6:23 AM, Koen van der Drift wrote:

> On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock <je...@ieee.org> wrote:
>> 
>> On 2012 Oct 15, at 03:45, Koen van der Drift <koenvanderdr...@gmail.com> 
>> wrote:
>> 
>>> So I cannot directly filter an array of dictionaries using a predicate? 
>>> That was the whole goal of my question, see my original post.
>> 
>> Oh, now I see.  I'd assumed that 'persons' was an array.  It's a dictionary!
> 
> Even better, it's an array of dictionaries!  :-)

Willeke probably addressed your issue best. The contents of the collection that 
you pass to the aggregate expression must be the same type of value as the left 
hand expression. So, to have "name IN {ARRAY}", ARRAY *must* be an array of 
"name"s. In most cases, that will be strings. When you pass dictionaries, how 
is the predicate to know what value to use from the dictionary? There is no 
magic here. Other than how curiously the NSPredicate interpreted the array of 
dictionaries. Interesting, but not useful to your purpose. In any case, the 
predicate that you have shown is not valid for your case.

Have you tried Willeke's suggestion? If it doesn't work, it doesn't mean that 
the predicate is bad, as -predicateWithFormat: is notorious for not working 
well with aggregate operations. Jerry Krinock's suggestion of constructing the 
predicate manually works most reliably, so that would be your next step to a 
solution.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to