Re: Retrieving the distinct values of an attribute for a Core Data entity
Re: Retrieving the distinct values of an attribute for a Core Data entity
- Subject: Re: Retrieving the distinct values of an attribute for a Core Data entity
- From: "I. Savant" <email@hidden>
- Date: Fri, 13 Feb 2009 14:08:25 -0500
On Fri, Feb 13, 2009 at 1:25 PM, Jon C. Munson II <email@hidden> wrote:
> I need to retrieve the distinct values of a given attribute in a Core Data
> entity.
It's important to remember that Core Data is not a database system.
It shares things in common, but because that is not its focus, there
are things you may have to do for yourself.
For example, I don't know that this is possible within a fetch
request (via a predicate), but I do know that you can fetch the
non-distinct data you want and use an array or set operator (
[myResults valueForKeyPath:@"@distinctUnionOfSets.foo"] ) to get the
distinct list of "foo" values. There are other set and array operators
as well:
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html
Is that what you're asking?
--
I.S.
_______________________________________________
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