Expand my Community achievements bar.

SOLVED

Mapping field with array while data loading from flat file

Avatar

Level 3

I am trying to load some purchase information from a flat file (csv) where it has just one product per line. My schema is using the OTB field group "Commerce Details" which has an array of Product List as below.

 

Aalokitoaami_0-1667816847518.png

As mentioned above, my file has one product information and I really want to map with the 0th item in the array. I did something like below and getting an error "The mapping for the wild card array path is incompatible. Please revise the mapping and try again"


Aalokitoaami_1-1667816903911.png

 

Is it possible to map array item using flat file, if yes how? If no, what are the supported options and any example will really helpful

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@itsme The design is such that a single row in a csv file is considered one Profile or Event.  Therefore mapping multiple rows in a csv file into one Event isn't possible.  This is far easier in JSON structure, I'd highly recommend using that.

 

Given that, if you have no other option... trying to think outside the box, don't know if this will work and never done this.  You may want to play around w/ multiple pipe delimited fields and see if that can work. It will be tricky and require a lot of debugging (and I don't have any sample code for you).  The idea would be passing in for each field in the Object Array:

Product ID = "123|456|789"

Quantity = 4|1|9

etc.

 

File looks like this:

[_id],[identity],[Product ID],[Quantity],[etc.]

 

Then you would have to create a calculated field for each element and map each element to the correct element in the target.  i.e. you hard code it.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

@itsme The design is such that a single row in a csv file is considered one Profile or Event.  Therefore mapping multiple rows in a csv file into one Event isn't possible.  This is far easier in JSON structure, I'd highly recommend using that.

 

Given that, if you have no other option... trying to think outside the box, don't know if this will work and never done this.  You may want to play around w/ multiple pipe delimited fields and see if that can work. It will be tricky and require a lot of debugging (and I don't have any sample code for you).  The idea would be passing in for each field in the Object Array:

Product ID = "123|456|789"

Quantity = 4|1|9

etc.

 

File looks like this:

[_id],[identity],[Product ID],[Quantity],[etc.]

 

Then you would have to create a calculated field for each element and map each element to the correct element in the target.  i.e. you hard code it.