Re: newbie question regarding setting up a master-detail data model with cocoa
Re: newbie question regarding setting up a master-detail data model with cocoa
- Subject: Re: newbie question regarding setting up a master-detail data model with cocoa
- From: shaun bear <email@hidden>
- Date: Mon, 11 Sep 2006 22:48:04 +0200
Hi I.S.
Thanks for taking time to answer my post. I understand how to make
a master/detail data model using relationships. The reason I am
trying to find an alternative approach is for importing data,
programatically, into the database. Using the relationship approach
means that I will have to iterate through the 'Master' table and then
import the 'Detail' rows in an inner-loop using a predicate to match
the id's. What I want to do is to import each table in a separate
loop without the use of predicates. I thought maybe there was a way
of doing this using the fetch relationship.
Shaun
On Sep 11, 2006, at 2:35 PM, I. Savant wrote:
Shaun:
Give this a THOROUGH read:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
index.html
You should not be thinking of primary keys, but rather just of
"relationships" in general. If you have an entity called "Master"
with a to-many relationship to an entity called "Detail", that's
all you need, really. We'll call the relationship "details" for
simplicity. Any "Detail" instances added to a "Master" instance's
"details" relationship are then related and you can ask that
"Master" instance for its "details". No primary key needed.
The docs explain this a lot more clearly, but that's about it.
You need to read and fully absorb the Core Data Programming Guide -
it's clear and well-written.
--
I.S.
On Sep 11, 2006, at 7:47 AM, shaun bear wrote:
i am new to programming on the mac and feel a little overwhelmed
by it, at this point, on the learning curve.I want to write an
application that imports data into 2 tables: 'Master' and 'Detail'
with a one-to-many relationship. They each have a primary key:
'id' that is already set before import. I then want to display
these tables in two grids,where changing the currently selected
record in the 'Master' table fetches the records with the same
'id' in the 'Detail' table. I have gone through several of the
tutorials for Core-data document based applications but none seem
to cover this scenario. If any one can describe the steps I need
to go through to achieve this or point me to some somewhere
describing how to do something like this, I would appreciate it.
Also any tips or hints for making this task easier would be much
appreciated. Thanks in advance for your help!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
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