• 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. Programmatically setting relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core data. Programmatically setting relationships


  • Subject: Core data. Programmatically setting relationships
  • From: Steven Hamilton <email@hidden>
  • Date: Sun, 1 Jun 2008 18:28:04 +1000

Hi folks,
Back again with more Core Data puzzles.

I have entities like so;

Account;
NSString	name
relationship	credit
relationship	debit

Transaction;
NSString	name
NSDate		date
relationship	toAccount	(reverse of credit in Account entity)
relationship	fromAccount	(reverse of debit in Account entity)

I have a tableview with a custom datasource as I have to mung data between the Object Model and the view. Using the datasource and delegate methods I can display data fine and I can alter and set the attributes name and date.

What I can't do is set change the relationships. In my tableView I'm displaying the Account name in the toAccount and fromAccount columns. I want to be able to type a new Account.name in there and have the Transaction object update the relationship to the new Account accordingly. Reading the core data docs I can't for the life of me figure out how to do this. I believe I need to take the name from the tableColumn, figure out which account it belongs to then somehow set that as the relationship by using KVC.

Any tips?
_______________________________________________

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


  • Follow-Ups:
    • Re: Core data. Programmatically setting relationships
      • From: mmalc crawford <email@hidden>
    • Re: Core data. Programmatically setting relationships
      • From: Steven Hamilton <email@hidden>
  • Prev by Date: Re: sorting an NSTableView
  • Next by Date: Re: email
  • Previous by thread: Re: sorting an NSTableView
  • Next by thread: Re: Core data. Programmatically setting relationships
  • Index(es):
    • Date
    • Thread