Configuring the parent Job - 7.2

Data Integration Job Examples

author
Talend Documentation Team
EnrichVersion
7.2
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development > Designing Jobs
EnrichPlatform
Talend Studio

Procedure

  1. In the Contexts view:
    1. Add the following three variables:
      • filename, type String
      • tablename, type String
      • directory, type Directory
    2. Specify the directory by clicking in the Value field of variable directory. Click the small button that appears and browse to the directory where the source files are stored.
  2. In the Basic settings view of the tFileList component, fill the Directory field with context.directory.
    Tip: Click in the field and press Ctrl+Shift to access a list of available variables.
  3. Double-click the tIterateToFlow component to open its Basic settings view, and configure the component as follows:
    1. Add a column named filename (type String) in the schema editor.
    2. Fill the Value field of the Mapping table with the CURRENT_FILE global variable generated by the tFileList component, in the format of ((String)globalMap.get("tFileList_1_CURRENT_FILE")).
  4. Double-click the tFixedFlowInput component to open its Basic settings view, and configure the component:
    1. Add two columns in the schema: file_name (type String) and table_name (type String).
    2. Select the Use Inline Table option, and define the following file-to-table mappings in the table:
      file_name table_name
      "customer_details.csv" "customer"
      "delivery_details.csv" "delivery"
      "employee_details.csv" "employee"
  5. Double-click the tMap component to open the map editor, and in the map editor:
    1. Drag the filename column of table row1 (which is from the tIterateToFlow component) and drop it onto the file_name column of table row2 (which is from the tFixedFlowInput component), to join the two tables for file name look-up.
    2. Click the spanner button to show the join properties, and set:
      • the Match Model to Unique match
      • the Join Model to Inner Join
    3. In the schema editor, add two columns to the out table: tablename (type String) and filename (type String).
    4. Drag the filename column of table row1 and drop it onto the filename column of table out.
    5. Drag the table_name column of table row2 and drop it onto the tablename of table out.
    6. Click OK to validate your settings and close map editor.
  6. Double-click the tJavaRow component, and enter the following code in the Code field.
    context.tablename = out.tablename;
    context.filename = out.filename;
  7. In the Basic settings view of the tRunJob component:
    1. Click the three-dot button next to the Job field and select the child Job you want to call from the Repository Content dialog box, LoadDynamicSchemaChild in this example.
    2. Select the Transmit whole context option to pass the context variables to the child Job.
  8. Press Ctrl + S to save the Job.