I just noticed last week that the tJava component has an iterate flow. Has anyone used this before? Is there an example of how to use it? Please note that I am not talking about the tJavaFlex component.
Just for clarification I am adding this photo and I modified the subject
Notice how it is the tJava Component that has the iterate flow
Solved! Go to Solution.
@Red,can you the below link may be usefull.
Just like other components, use the iterate connection to connect tJava to a starting component such as tFileInputDelimited or others.
Have a look to the documentation for more details
I am trying to figure out why the tJava component has an iterate flow. Is it possible to use? See the picture that I added for clarification.
It acts similar to a tFlowToIterate. Let's say, you send 10 rows from a table to tJava and print something. You will only see that print once. You then iterate to another tJava where you can then print for each individual value.
I tried to grab row1 and got a null as expected, but after the iterate System.out.println(row1.newColumn) returns the values I wanted.
I am doing nothing there, tjava is what it is. tJava is just a placeholder here. It cannot pass anything across but continue a flow. The behavioral benefit of using the iterate function is the ability to capture the row information coming out of your input. Again, this can be achieved using other components. The behavior is part of Talend and the java code it generates. You may be overcomplicating things.
What are you trying to achieve with this?
So, there was noting in the other tJava_3 component controlling the iterator? I guess the iterator runs based on the number of rows that were passed in the row1 flow. Is there any way to control the iterator in the tJava_3 component?
The overall goal of this post was to see how a tJava component controls the iterate flow. From our discussion I now understand that the iterate flow is based on the rows which were fed into the tJava component. There is no way control the iterator from inside the tJava component using java.