• 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
Core Data: using array operators in a fetch spec?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data: using array operators in a fetch spec?


  • Subject: Core Data: using array operators in a fetch spec?
  • From: Terrence Talbot <email@hidden>
  • Date: Wed, 17 Aug 2005 09:50:39 -0700


One issue that I'm trying to find the cleanest solution to is to fetch objects from the stack based on the number of objects at the other end of a to-many relationship. To put it in terms of the Employees example, let's say I wanted to find all managers who have 5 or more direct reports.


A shorthand way to express this would be to ask for all managers where "employees.@count >= 5". Very easy to express, but apparently not useable, at least as formulated above, in a fetch specification. Please correct me if I'm wrong.

What's the best way to do this? I have vague recollections from EOF and DataCrux about using subqueries, but I don't quite see how to do this in Core Data, if it's even possible. I suppose I could fake that by fetching every manager and then testing [[manager employees] valueForKeyPath:@"@count"]. Just wondering if there's either a more efficient way to do it, or to express it, or both.


Terrence


_______________________________________________ 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
  • Follow-Ups:
    • Re: Core Data: using array operators in a fetch spec?
      • From: Scott Ellsworth <email@hidden>
  • Prev by Date: Re: Newbie question (no idea where to start) - Create Interface Programatically
  • Next by Date: Re: Core Data: using array operators in a fetch spec?
  • Previous by thread: Re: Newbie question (no idea where to start) - Create Interface Programatically
  • Next by thread: Re: Core Data: using array operators in a fetch spec?
  • Index(es):
    • Date
    • Thread