• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: filtering an array of entities using NSPredicate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filtering an array of entities using NSPredicate


  • Subject: Re: filtering an array of entities using NSPredicate
  • From: Keary Suska <email@hidden>
  • Date: Mon, 15 Oct 2012 09:51:52 -0600

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

> On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock <email@hidden> wrote:
>>
>> On 2012 Oct 15, at 03:45, Koen van der Drift <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: filtering an array of entities using NSPredicate
      • From: Koen van der Drift <email@hidden>
    • Re: filtering an array of entities using NSPredicate
      • From: Koen van der Drift <email@hidden>
References: 
 >filtering an array of entities using NSPredicate (From: Koen van der Drift <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Jerry Krinock <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Koen van der Drift <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Koen van der Drift <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Willeke <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Willeke <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Koen van der Drift <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Jerry Krinock <email@hidden>)
 >Re: filtering an array of entities using NSPredicate (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: filtering an array of entities using NSPredicate
  • Next by Date: Re: filtering an array of entities using NSPredicate
  • Previous by thread: Re: filtering an array of entities using NSPredicate
  • Next by thread: Re: filtering an array of entities using NSPredicate
  • Index(es):
    • Date
    • Thread