Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
I think this is the solution: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; [fetchRequest setEntity: [NSEntityDescription entityForName: @"Person" inManagedObjectContext: context]]; [fetchRequest setPredicate: [NSPredicate predicateWithFormat: @"name IN %

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
On Mon, Oct 15, 2012 at 11:51 AM, Keary Suska 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

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Keary Suska
On Oct 15, 2012, at 6:23 AM, Koen van der Drift wrote: > On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock wrote: >> >> On 2012 Oct 15, at 03:45, Koen van der Drift >> wrote: >> >>> So I cannot directly filter an array of dictionaries using a predicate? >>> That was the whole goal of my questi

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
On Mon, Oct 15, 2012 at 8:19 AM, Jerry Krinock wrote: > > On 2012 Oct 15, at 03:45, Koen van der Drift > 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 'per

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Jerry Krinock
On 2012 Oct 15, at 03:45, Koen van der Drift 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! But that should still work

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Koen van der Drift
So I cannot directly filter an array of dictionaries using a predicate? That was the whole goal of my question, see my original post. - Koen. On Oct 15, 2012, at 6:33 AM, Willeke wrote: > > Op 15 okt 2012, om 02:05 heeft Koen van der Drift het volgende geschreven: > >> >> On Oct 14, 2012,

Re: filtering an array of entities using NSPredicate

2012-10-15 Thread Willeke
Op 15 okt 2012, om 02:05 heeft Koen van der Drift het volgende geschreven: > > On Oct 14, 2012, at 7:56 PM, Willeke wrote: > >> the predicate should be something like >> name IN {"Jones A.", "Williams S.", "Brown M.", "Tobias S."} >> >> what is persons in this statement? >> [fetchRequest setP

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Willeke
> Maybe another clue, if I NSLog the predicate, I get this: > > name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = > "Brown M."}, {"name" = "Tobias S."}} > > That seems as expected to me. > the predicate should be something like name IN {"Jones A.", "Williams S.", "Brown M.", "

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
On Oct 14, 2012, at 10:43 AM, Jerry Krinock wrote: > On 2012 Oct 14, at 07:05, Koen van der Drift > wrote: > >> name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = >> "Brown M."}, {"name" = "Tobias S."}} >> >> That seems as expected to me. > > It says that the name should be

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Jerry Krinock
On 2012 Oct 14, at 07:05, Koen van der Drift wrote: > name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = > "Brown M."}, {"name" = "Tobias S."}} > > That seems as expected to me. It says that the name should be in a set of predicates, which are boolean. That doesn't make sens

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
Maybe another clue, if I NSLog the predicate, I get this: name IN {{"name" = "Jones A."}, {"name" = "Williams S."}, {"name" = "Brown M."}, {"name" = "Tobias S."}} That seems as expected to me. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.

Re: filtering an array of entities using NSPredicate

2012-10-14 Thread Koen van der Drift
On Sat, Oct 13, 2012 at 11:58 PM, Jerry Krinock wrote: > So you need to experiment with different methods. > > • Remove the -setPredicate: statement. Now is filteredPersons everything in > the store, as expected, or still empty? Yes, it contains all the names currently in the store. > • Chang

Re: filtering an array of entities using NSPredicate

2012-10-13 Thread Jerry Krinock
It looks to me like what you're doing should work as you expect. I don't think you are violating any of the predicate gotchas in Core Data Programming Guide ▸ Persistent Store Features. So you need to experiment with different methods. • Remove the -setPredicate: statement. Now is filteredP

filtering an array of entities using NSPredicate

2012-10-13 Thread Koen van der Drift
I have a large array for Person entities, and want to filter them before importing into my Core Data database, so that each Person will be only once in the database based on the name. The names are pulled from a database, and have the format: @"Jones, A." After some searching, I came up with t