Re: filtering an array of entities using NSPredicate
Re: filtering an array of entities using NSPredicate
- Subject: Re: filtering an array of entities using NSPredicate
- From: Koen van der Drift <email@hidden>
- Date: Mon, 15 Oct 2012 12:09:17 -0400
On Mon, Oct 15, 2012 at 11:51 AM, Keary Suska <email@hidden> wrote:
> 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.
No, I haven't had a chance to try her solution yet, but that's the
first on my list when I get back to my Mac. I have been playing a bit
with the NSExpressions, but haven't had any luck with it. Again, a
nice learning curve.
- Koen.
_______________________________________________
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