• 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
Re: Can CoreData return only unique results of an attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can CoreData return only unique results of an attribute


  • Subject: Re: Can CoreData return only unique results of an attribute
  • From: Philip Bridson <email@hidden>
  • Date: Tue, 26 Feb 2008 23:03:36 +0000

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:
40mac.com


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


  • Follow-Ups:
    • Re: Can CoreData return only unique results of an attribute
      • From: "Adam Gerson" <email@hidden>
References: 
 >Can CoreData return only unique results of an attribute (From: "Adam Gerson" <email@hidden>)

  • Prev by Date: Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
  • Next by Date: Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
  • Previous by thread: Can CoreData return only unique results of an attribute
  • Next by thread: Re: Can CoreData return only unique results of an attribute
  • Index(es):
    • Date
    • Thread