Re: filterPredicate question
Re: filterPredicate question
- Subject: Re: filterPredicate question
- From: Phil Frost <email@hidden>
- Date: Mon, 28 Nov 2005 10:56:57 -0500
On Mon, Nov 28, 2005 at 04:43:25PM +0100, Kubernan from 10191 Technologies wrote:
> Hello,
>
> The entity of my model (say bank Account) has a reflective
> relationship (because a bank
> account is attached to a main bank account).
> In my GUI, creating a new bank account, i have to select the main
> bank account with a popup menu.
> What i want to do is to populate automatically the popup menu with
> accounts set as "main" (a bool attribute in Account).
> For that i thought i could use a filterPredicate with "content
> values" binding of the popup menu but i didn't
> find a place in IB to put my predicate.
>
> What should i do for filtering my popup menu content ?
The filter predicate can be set by using the 'filter predicate' binding
of NSArrayController. You will have to create a predicate on something
else (window controller, app delegate, etc) and bind to that.
The fetch predicate can also be set in IB by looking at the attributes
of an NSArrayController. If it is in entity mode, there is a text area
that says by default "No predicate specified." You can type a predicate
in there (like "main = true") and hit the "Set Predicate" button to set
it.
The difference between the filter and fetch predicates is when the
predicate is applied. The fetch predicate will be used when the array
controller sends executeFetchRequest:error: to the
NSManagedObjectContext. The context will return only those objects that
match. Then, the NSArrayController filters the results with the filter
predicate.
_______________________________________________
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