Re: Core Data Implementation question
Re: Core Data Implementation question
- Subject: Re: Core Data Implementation question
- From: "Marcus S. Zarra" <email@hidden>
- Date: Wed, 20 Jul 2005 15:00:10 -0600
Looking at the link you gave me it appears that I can set a trigger on the
child relationship that will trigger the other values. I will test this once
I get back to a proper machine and off this cursed windows device.
Thank you very much for the link, it should solve this situation, I will
post back to confirm.
Marcus
On 7/20/05, Marcus S. Zarra <email@hidden> wrote:
>
> Thanks for the link, I will be looking into that. In this situation the
> derived value is derived from values that are inside of the children and it
> occurs after the children are first created. In other words the method does
> the following:
>
> 1. Generate a new child
> 2. Set values inside of that child
> 3. Add child to parent
> 4. ???
> 5. Notify the GUI to update the other fields.
>
> Step 4 and 5 are a mystery to me at this point. :)
>
> Marcus
>
> On 7/20/05, Charilaos Skiadas <email@hidden> wrote:
> >
> > On Jul 20, 2005, at 12:03 PM, Marcus S. Zarra wrote:
> >
> > I am trying to figure out the best way to approach this issue with Core
> > Data.
> >
> > I have a parent object that has a to-many relationship with a child
> > object.
> > The child has a to-one relationship with the parent.
> >
> > Parent <-->> Child
> >
> > Adding new children works correctly and the GUI (which displays the
> > children
> > in a table) works perfectly.
> >
> > The problem comes in with a couple of attributes in the parent. The
> > parent
> > has a couple of values that are changed based on the children. The
> > children
> > are added progammatically and I need a way to notify any observers that
> > the
> > parent attributes have changed when I add the child. I have tried doing
> > the
> > following:
> >
> >
> > Are the values only changing when a child is added? In that case, you
> > should I think be able to just use the "derived value" approach described in
> >
> >
> > http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/03_CustomClass/chapter_4_section_3.html#//apple_ref/doc/uid/TP40001799-CH219-DontLinkElementID_14
> >
> > and the the "children" key as the key in the "initialize" method that
> > triggers the notification.
> >
> > If on the other hand the attributes depend on attributes in the children
> > themselves, then I am not too sure what the best way to accomplish that is,
> > but I sure would like to know.
> >
> > [parent willChangeValueForKey:@"xxx"];
> > //add child
> > [parent didChangeValueForKey:@"xxx"];
> >
> > but this seems to mess up the actual update of the child.
> >
> > Does anyone know of a cleaner way to get this to work? Note that the
> > parent
> > attribute "xxx" is a calculated value in the parent object and not a
> > value
> > stored in the core data repository.
> >
> > Thanks for any insight.
> >
> > Marcus S. Zarra
> >
> >
> > Haris
> >
> >
> >
>
_______________________________________________
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