We are trying the map multiple fields in a XML (EDI) into one field in another XML in a XML Map connector. We use the implode formatter for this. But it isn’t working, we only get the first item. But we want all the NTE02 fields joined with a newline as separator.
Your requirement is to store each NTE02 field value for each mapping iterations within the XML map with comma ”,” separated. To do this you will require to create an array variable, let me explain this step by step.
Below are the samples I’m using your sample as a Source and below one as Destination within the XML map:
Destination xml file:
<Target> <Remarks>PALLETS COVERED WITH STRETCH HOOD</Remarks> </Target>
1. Create a Virtual Loop over the NTE Segment (as you want to loop over all NTE segments for all NTE02 fields) . 2. Add a child Variable and name the variable(I provided NTE02Data# as a variable name) and map the NT02 Field to this Variable.
Add Remarks Field as a sibling field to the Virtual loop
Then open the Expression editor to the Remarks Field and enable the script mode and provide the script below:
Your requirement is to store each NTE02 field value for each mapping iterations within the XML map with comma ”,” separated. To do this you will require to create an array variable, let me explain this step by step.
Below are the samples I’m using your sample as a Source and below one as Destination within the XML map:
Destination xml file:
<Target> <Remarks>PALLETS COVERED WITH STRETCH HOOD</Remarks> </Target>
1. Create a Virtual Loop over the NTE Segment (as you want to loop over all NTE segments for all NTE02 fields) . 2. Add a child Variable and name the variable(I provided NTE02Data# as a variable name) and map the NT02 Field to this Variable.
Add Remarks Field as a sibling field to the Virtual loop
Then open the Expression editor to the Remarks Field and enable the script mode and provide the script below: