Mapper 2.0 - Possible to build multiple array elements?
I'm trying to use Mapper 2.0 on an EDI FTP transfer. My source data is tabular and doesn't match the shape of the EDI document very well. I need to build an "N1" loop of 3 elements (in non-EDI terms, this is an array of objects with the same properties on each object). My source data isn't an array that I can straightforward map array-to-array, instead I need to transform the data in the mapping.
Did I mention I'm trying to avoid script to transform my source data? Yeah, I am - I want to see how far mapper 2.0 can get me in avoiding scripting.
So the problem is, I can defined mapping for the N1 loop and add sub mappings, but that will only create a single element in the array and I need to create 3. I'm not seeing anyway to accomplish what I need, but thought I'd ask here in case there is a trick or advanced concept that will do what I need.
Here's my current mapping:
which produces:
...
"hl_shipment": [
{
"n1": [
{
"entity_identifier_code_n101": "ST",
"name_n102": "",
"identification_code_qualifier_n103": "67",
"identification_code_n104": "TBD - UPS Warehouse Code"
}
]
}
...
What I need is a way to create:
...
"hl_shipment": [
{
"n1": [
{
"entity_identifier_code_n101": "ST",
"name_n102": "",
"identification_code_qualifier_n103": "67",
"identification_code_n104": "TBD - UPS Warehouse Code"
},
{
"entity_identifier_code_n101": "BY",
"name_n102": "",
"identification_code_qualifier_n103": "asd",
"identification_code_n104": "TBD"
},
{
"entity_identifier_code_n101": "XX",
"name_n102": "",
"identification_code_qualifier_n103": "666",
"identification_code_n104": "Maiden Rules!!"
}
]
}
...
Any ideas? Again, I know I can transform my source to better support this, but I'm hoping the new mapper as a way to accommodate it.
Comments
Hello Steve,
Could you add the source field (right side) as"$,$,$" for the destination field n1 [object]?
This will create 3 tabs as shown below. Go to each tab and configure the 3 objects separately.
Let me know if this works.
And this is why I asked for a training session on mapper 2.0 on the University Forum.
Noted. Thank you for sharing feedback. We will get more sessions on Mapper 2.0 in university.
Amanjot! - this is excellent! :)
This is EXACTLY what I needed and was hoping for. Thank you for the reply, you've helped greatly.
[EDIT] Just found a great article by Tom Santiago that explains this JSONPath notation!
BTW, I second Dave's request; it's a powerful tool, but we've failed to adopt it because it's easy to get blocked due to lack of knowledge on how it all works.
Steve,
Glad that worked for you. I just wanted to provide another screenshot to show how the $, $, $ notion looks expanded
Kelly Izer We may be talking about different things. Your screen shot shows nested objects arrays, but I was looking to create multiple elements/records/entriesin the array. Here's a screen shot showing my situation:
Which results in (perfect!):
Please sign in to leave a comment.