Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacDonaldsd

macrumors 65816
Original poster
Sep 8, 2005
1,005
0
London , UK
Im building an application that relies heavily on core data.

I was wondering if there is a way to import a single instance of a entity ?

Maybe by running a applescript or something ?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Do you mean that you want import an NSManagedObject from one model to another?

Do you wish to copy related objects as well?
 

MacDonaldsd

macrumors 65816
Original poster
Sep 8, 2005
1,005
0
London , UK
Basically Im doing a timetable application. So modules that are related to assessments is what im referring to here.

I would like to be able to just import assessment details. So a user can just import the details rather than typing them manually as everyone will have the same information.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
So you want to import the assessment information from another file into your Core Data model for your application?

In which case you'll need to read in the data using a normal (non Core Data) Cocoa data input system and then attach the data to the relevant NSManagedObject.
 

MacDonaldsd

macrumors 65816
Original poster
Sep 8, 2005
1,005
0
London , UK
So you want to import the assessment information from another file into your Core Data model for your application?

In which case you'll need to read in the data using a normal (non Core Data) Cocoa data input system and then attach the data to the relevant NSManagedObject.

So read it to a Normal object, then copy/create a NSManagedObject using code "behind the scenes" ?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Pretty much but you may not need to read it into a normal object at all as you may be able to read it as an int, double, BOOL, NSString etc. and then attach it directly to the NSManagedObject you wish to store the data in.

However you have the basic idea.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.