This project is read-only.

Mapping One ContentItem to Another

Topics: Writing modules
Oct 6, 2015 at 8:40 AM
Hi I am just getting started with Orchard so currently reading Sipke's excellent articles and trying to get to grips with the source.

One of my aims is to provide the ability for a user to be able to map arbitrary field values from one content item to another. My use case is to provide the ability to import a file e.g. csv and then from the data populate a "core" item e.g. product. My initial thought is for the user to create a simple content type to represent the imported fields from the csv maybe with something like a batch part containing a batch id to identify them. I would then like to pass this into a workflow that could map the simple csv item fields to say a product item with associated product part fields.

I was hoping to provide a simple UI that allows user to select the FROM content type and the TO content type, iterate over the fields of both and give them the ability to say map FROM type A to TO type B.

I was thinking some sort of Mapping content type to store the two content types and maybe a new mapping field which has the FROM and TO references for the fields.

I guess my first question is does anything like this exist? I cant see anything but obviously may have missed it.

If not my question is really what is the best way to dynamically iterate the content type fields and instantiate new content type and set field values. I saw an article from Bertrand talking about using indexers to access field values but I think this was an old article referring to Clay backed items which I believe have now been replaced.