• 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: NSPredicate and NOT IN and array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicate and NOT IN and array


  • Subject: Re: NSPredicate and NOT IN and array
  • From: Greg Herlihy <email@hidden>
  • Date: Tue, 23 May 2006 19:13:13 -0700
  • Thread-topic: NSPredicate and NOT IN and array

Just wrap the affirmative predicate in parentheses and place a NOT in front
of it:

    [NSPredicate predicateWithFormat:@"NOT (id in %@)", listOfIDs];

Greg

On 5/23/06 3:00 PM, "David Alter" <email@hidden> wrote:

> I would like to get an array of items that are NOT IN and array. Is
> there a way to do this with a NSPredicate
>
> Example:
>
> NSArray *listOfIDs = [self getSomeIDs];
> NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init]
> autorelease];
> [fetchRequest setEntity:
> [NSEntityDescription entityForName:@"items"
> inManagedObjectContext:myMOC ] ];
> [fetchRequest setPredicate: [NSPredicate predicateWithFormat: @"(id
> NOT IN %@)", listOfIDs]];
>
> Any ideas would be great.
>
> thanks
> -dave
>
>
>  _______________________________________________
> 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


 _______________________________________________
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

References: 
 >NSPredicate and NOT IN and array (From: David Alter <email@hidden>)

  • Prev by Date: Re: What encoding to use to turn NSData from a subprocess into an NSString?
  • Next by Date: Re: Core Data Import
  • Previous by thread: NSPredicate and NOT IN and array
  • Next by thread: NSMatrix with NSTextFieldCells
  • Index(es):
    • Date
    • Thread