Core Data: using array operators in a fetch spec?
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