Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Import and update #434

Closed
oliverfoggin opened this Issue · 2 comments

2 participants

@oliverfoggin

Not so much an issue, more just a request for help.

I'm trying to use Magical Record to import data into my CoreData db.

I'm working on the entity Person at the moment.

A Person has firstName, lastName, idString attributes. (I know I don't need the idString, I'm not using it internally, it is used to talk back to the server).

Anyway, if I already have the person...

firstName - John
lastName - Smith
idString - 1
And I download the JSON...

[
{
firstName: John,
lastName: Doe,
idString: 1
},
{
firstName: Michael,
lastName: Caine,
idString: 2
},
{
firstName: Angelina,
lastName: Jolie,
idString: 3
}
]
I'd want the import to add Michael and Angelina and to update John Smith to John Doe because it already exists with the same idString.

Is it possible to do this? I've been reading this blog... http://www.cimgf.com/2012/05/29/importing-data-made-easy/ about automatic mapping of key names etc... and wondered if I could exploit this to do what I want?

I know this is something to do with relatedByAttribute key from the blog but I'm not sure where to set it and what to?

If someone could advise me on this I'll be able to continue with everything else on my own.

Thanks very much.

@casademora
Owner
@oliverfoggin

Sorry, will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.