• 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
predicate with NSDates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

predicate with NSDates


  • Subject: predicate with NSDates
  • From: Andres <email@hidden>
  • Date: Thu, 18 Oct 2007 16:57:11 -0400

Hello,

My Employee entity has a too many relationship called "myVacations"  to a
Vacation entity which has date attributes "startDate" and "endDate". I want
to find out which employees are on vacation on a specific NSDate. I am
having trouble with the predicate below. What's the correct predicate
format?


  NSDate *today = [NSDate date];
  NSEntityDescription *entityDescription = [NSEntityDescription
entityForName:  @"Employee"  inManagedObjectContext: managedObjectContext];
  NSFetchRequest *request = [[NSFetchRequest alloc] init];

  [request setEntity: entityDescription];

  NSPredicate *predicate = [NSPredicate predicateWithFormat:  @"(
myVacations.startDate < %@) AND ( myVacations.endDate > %@) ",  today,
today];
  [request setPredicate: predicate];

  NSError *error =  nil ;
  NSArray *employeesOnVacationToday = [managedObjectContext
executeFetchRequest:
request error: &error];

I get the following error:
  -[NSCFArray compare:]: selector not recognized [self = 0x3d3690]


Thanks!
_______________________________________________

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

  • Prev by Date: Re: Mulit-state buttons
  • Next by Date: NSLocalizedString and plural forms
  • Previous by thread: Re: Mulit-state buttons
  • Next by thread: Re: predicate with NSDates
  • Index(es):
    • Date
    • Thread