views:

167

answers:

1

I'm familiar with how to feed data from one Core Data entity into an NSPopUpButton item so that it can be selected for another. Bindings like so:

For the values themselves:

-> ValueSelection.Content
    Bind To: Value Source Entity
    Controller Key: arrangedObjects
    Model Key: N/A

For the values displayed in the NSPopUpButton:

-> ValueSelection.ContentValues
    Bind to: Same entity as ValueSelection.Content
    Controller Key: arrangedObjects
    Model Key: the name of the attribute you wish to have displayed

To link it to the destination value:

-> ValueSelection.SelectedObject
    Bind to: Destination entity
    Controller Key: selection
    Model Key: Name of the attribute/relationship in the destination entity.

What I'm trying to do is figure out if there is a way to set up a filter (I'm guessing in ContentValues) where you can only have it grab entries from that entity that have a certain attribute flag checked (e.g. say I'm pulling from my users entity and I just wanted to list male or female users).

+2  A: 

NSArrayController has a "filter predicate", which can be set in Interface Builder or in code (via the method in the docs to which I linked). See the Predicates Programming Guide to figure out what predicate you'll need to supply for your desired filter.

Joshua Nozzi