Scenario: Iterating on a list and retrieving the values - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
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 Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a two component Job in which a list is created and iterated upon in a tForeach component. The values are then retrieved in a tJava component.

  • Drop a tForeach and a tJava component onto the design workspace:

  • Link tForeach to tJava using a Row > Iterate connection.

  • Double-click tForeach to open its Basic settings view:

  • Click the [+] button to add as many rows to the Values list as required.

  • Click on the Value fields to enter the list values, between double quotation marks.

  • Double-click tJava to open its Basic settings view:

  • Enter the following Java code in the Code area: System.out.println(globalMap.get("tForeach_1_CURRENT_VALUE")+"_out");

  • Save the Job and press F6 to run it

    The tJava run view displays the list values retrieved from tForeach, each one suffixed with _out: