Talend tForeach

Talend tForeach is the same as the foreach loop that creates a loop and iterates the same. In this chapter, we show you a simple example of the tForeach. Drag and drop the tForeach component to the job designer window.

Talend tForeach 1

As you can see from the tForeach below, it has only the Values section in the Component tab to add values for the foreach iteration.

Talend tForeach 2

Let me use the + button to add few values.

Talend tForeach 3

Next, we used the tJava component to display or print those foreach iteration values.

Talend tForeach 4

Let me add the following Java code to read the current value in the foreach loop iterator. Next, run the Talend tForeach job.

Talend tForeach 5

From the below tForeach image, you can see that it has been executed 7 times for all the values, and displayed the result using the println statement.

Talend tForeach 6