Parameterised Core Data fetch predicate in NSArrayController?
Parameterised Core Data fetch predicate in NSArrayController?
- Subject: Parameterised Core Data fetch predicate in NSArrayController?
- From: Luke Evans <email@hidden>
- Date: Thu, 14 Feb 2008 14:30:43 -0800
Dear Cocoa list,
I'm wondering if there's a straightforward was to have an
NSArrayController make a Core Data fetch for its content where the
fetch predicate can match against a parameter bound to some selection
in another control.
In my case I have a list of objects of class A in a control with
single selection, and would like another control to be populated with
Core Data items of a particular entity, where some attribute is
related to something in the selected A. The fetch predicate could of
course be something like:
attribute == A.foo
and the Entity name set to the right kind (having 'attribute' as an
attribute). However, the key 'A.foo' would need to be reachable, and
I don't think there's any binding I can make that simply gets the
selection of another control into the scope of this one so that I
could address a key path on it.
Clearly, I'm trying to be 'frugal' here. I'm aware that I can achieve
what I want by binding the content to, say, a Window Controller key
that has the appropriate logic in its get accessor to generate the
list of objects I want (from having a binding to the selection in the
'upstream' control).
I suppose my question boils down to the following:
If you want to 'restart' the master-detail chain between controls,
because there's no way to simply refer to a child (model key) of a
selection binding, do you essentially have to resort to some
'external' logic to do this?
It strikes me that if I could have a 'general' binding to the upstream
selection, then I may be able to refer to this via a key in my filter
predicate and thus start a new 'master' set of objects.
Cheers
-- Lwe
_______________________________________________
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