Import File Type - Link to many via a single mapping

Hello :slight_smile:

Using Import File Type I’m looking to relate each record created to several records in a related object via data passed to a single mapping, I was wondering if this is possible? Or can Import File Types only relate a single record for each mapping?

Long version:

I have data to import into Create via a CSV from our waste partner, a set of records of street bins including collection days. Some bins are collected once a week, others are collected several times.

Collection days have unique IDs, these are listed are for each Bin record as a single field of delimited values. So an entry in the CSV might look a bit like this, with the unique ids for Days delimited by a pipe

dog bin, corner of something street, 61af93501554c242f|61af901554c243c|5d442708066b93, something else, something else

I have an object for the Bin records, and I have an object acting as a lookup for the Days with title and unique ID for each. The Days object will be used elsewhere. These 2 objects are related as Many to Many.

On import I wish to generate a relationship between a Bin record and each of the relevant entries in the Days object, using the unique IDs.

I was wondering if this can be achieved with Import File Types, perhaps by passing the data correctly through a pre-processor? I experimented with returning Day ids as an Array just to see what would happen, safe to say that Create didn’t like that :grin:

Or do I need to go another way and maybe build an import widget to handle it all in code?

Thanks!

Hi Russ,

I have done something like this before, it is done in Code but not necessary to replace the whole thing.

The way I have done this is, store your pipe separated column into a property against your bin records. Once the import has processed the line (you can use the event triggers against matched/created records on the import file type) to then trigger a code studio event action.

The code studio event action, you can then split at the pipes to create an array of records then loop through these with whatever match logic is required and add the relationships. Don’t forget here if you are using it as a maintenance import then you might want to consider clearing relationships first before adding new relationships.

Hopefully this helps or if it needs a deeper explanation, let me know.

Carl

Ahhh yes of course, thanks Carl that’s super helpful I’ll crack on and build that now :slight_smile:

Russ