Mapping two inputs to a single output - 7.3

Talend Data Mapper User Guide

Version
7.3
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2023-01-05

Configure your map to combine two parallel loops into nested loops.

Procedure

  1. Drag and drop the input row1Record element to the output customer element to automatically map the id, name and city elements.
  2. Click the output bill element and drop a SimpleLoop function in its Loop tab, then drop the input row2Record element on the Input Map Element argument.
  3. Drop an Equal function on the Filter argument, then drop the input customerId element on the First Value argument, and the output customer/id on Second Value.

    Example

  4. Drag and drop the input billId on the output bill/id and the input price on the output price.
  5. Save your map, then open the Job in the Integration perspective, go to the Run tab and run the Job.

Results

The output file is generated in the location specified in the tFileOuputRaw component. It should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
   <customer>
      <id>111</id>
      <name>John</name>
      <city>New York</city>
      <bill>
         <id>asd-589</id>
         <price>123.58</price>
      </bill>
   </customer>
   <customer>
      <id>591</id>
      <name>Billy</name>
      <city>Los Angeles</city>
      <bill>
         <id>sry-84u</id>
         <price>352.89</price>
      </bill>
      <bill>
         <id>xoi-htr</id>
         <price>36.55</price>
      </bill>
   </customer>
   <customer>
      <id>891</id>
      <name>Bob</name>
      <city>Chicago</city>
      <bill>
         <id>111-gfs</id>
         <price>3.58</price>
      </bill>
      <bill>
         <id>8j9-t44</id>
         <price>99.95</price>
      </bill>
      <bill>
         <id>999-gre</id>
         <price>799.95</price>
      </bill>
   </customer>
</root>