• 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
Core Data relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data relationships


  • Subject: Core Data relationships
  • From: J Tichenor <email@hidden>
  • Date: Thu, 23 Jun 2005 21:59:53 -0700

Another probably easy question but damned if I can figure it out.

I have two Entities, Budget and EffectUnit. There is a to-many relationship from Budget to EffectUnit. In EffectUnit, there is a calculated iVar representing the EffectUnit's totalCost.

In Budget I need to create a iVar that will hold the calculated total of all EffectUnits.

The question is: using the relationship, how do I burrow into each EffectUnit and grab it's totalCost to cumulatively sum?

In the good old OO days, this was easy -- array of EffectUnits, enum through the array, grab the value and sum it together.

But here in relationship land, I'm not sure how I relate to objects along the graph.

FYI -- this is what I wrote that doesn't work: totalCostOfUnits = [self valueForKeyPath:@"email@hiddenotal"];

Needless to say I get an error. I don't think the effectUnits part is right, although it is the name of the relationship? If this is right, how does the program know to run all the objects in the relationship?

Here is the error: "NSRunLoop ignoring exception '[<EffectUnitManagedObject 0x31f320> valueForUndefinedKey:]: this class is not key value coding-compliant for the key totalCostOfUnits.' that raised during posting of delayed perform with target 3a4890 and selector 'invokeWithTarget:"

EffectUnitManagedObject is the subclassed NSManagedObject for the EffectUnit entity, which has the custom accessor method giving up unitTotal...

Anyway, if anyone can point a young programmer in the right direction I'd surely appreciate it.

James Tichenor
_______________________________________________
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


  • Follow-Ups:
    • Re: Core Data relationships
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: NSImage is a pain
  • Next by Date: (Inverse) relationship lost after being set properly
  • Previous by thread: Re: [[eSellerateObject alloc] init] causes SIGTRAP
  • Next by thread: Re: Core Data relationships
  • Index(es):
    • Date
    • Thread