Re: Can CoreData return only unique results of an attribute
Re: Can CoreData return only unique results of an attribute
- Subject: Re: Can CoreData return only unique results of an attribute
- From: "Adam Gerson" <email@hidden>
- Date: Tue, 26 Feb 2008 19:01:28 -0500
I did look into NSPredicate and the Predicate Programming Guide. I
understand the concept of filtering the ArrayController. I just didn't
know how to write en expression asking for all unique values from the
ArrayController for a given key. In the Predicate examples they filter
a single potential result against some criteria. Can I say "only
return unique values from yourself"?
Adam
On Tue, Feb 26, 2008 at 6:03 PM, Philip Bridson
<email@hidden> wrote:
>
>
> Yeah there is.
>
> From the documentation:
>
>
>
> You can set a predicate for an array controller to filter the content array.
> You can set the predicate in code (using setFilterPredicate:). You can also
> bind the array controller's filterPredicate binding to a method that returns
> an NSPredicate object. The object that implements the method may be the
> File's Owner or another controller object. If you change the predicate,
> remember that you must do so in a key-value observing compliant way (see
> Key-Value Observing Programming Guide) so that the array controller updates
> itself accordingly.
>
> You can also bind the predicate binding of an NSSearchField object to the
> filterPredicate of an array controller. A search field's predicate binding
> is a multivalue binding, described in Binding Types.
>
> Or simply, create a small method in a object, such as the file owner, that
> returns a NSPredicate. Then bind the controller's filter predicate to the
> file owners predicate method. This will automatically filter your
> controllers values.
>
> Hope this helps.
>
> Phil.
>
> On 26 Feb 2008, at 22:00, Adam Gerson wrote:
>
>
>
> I have a core data object. I would like to populate a TableView with
> only the unique entires for a specific property. Clearly I could
> filter the results in code, I was wondering if there was away for core
> data and bindings to do it.
>
> Adam
> _______________________________________________
>
> 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
>
_______________________________________________
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