Five Stars

How to use the iterate flow from a tJava component?

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

 

image.png

 

Notice how it is the tJava Component that has the iterate flow

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: How to use the iterate flow on a tJava component?

No, whatever is in the tjava component would just run first. There would be no way to control the iteration from there.

12 REPLIES
Eleven Stars

Re: How to use the iterate flow on a tJava component?

Thirteen Stars TRF
Thirteen Stars

Re: How to use the iterate flow on a tJava component?

Hi,

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

https://help.talend.com/reader/lChEGrKIFb8DXl9sRsX~~A/UoOiqbEZUVnVX9rFcx02QQ


TRF
Five Stars

Re: How to use the iterate flow on a tJava component?

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. 

Six Stars

Re: How to use the iterate flow on a tJava component?

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.

Six Stars

Re: How to use the iterate flow on a tJava component?

Capture.PNG

Six Stars

Re: How to use the iterate flow on a tJava component?

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.

Five Stars

Re: How to use the iterate flow on a tJava component?

Can I see how you configured tJava_3?  What java does it contain? Are you using java to control it's Iterate flow?  

Six Stars

Re: How to use the iterate flow on a tJava component?

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?

Six Stars

Re: How to use the iterate flow on a tJava component?

Capture.PNG

Five Stars

Re: How to use the iterate flow on a tJava component?

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?

Six Stars

Re: How to use the iterate flow on a tJava component?

No, whatever is in the tjava component would just run first. There would be no way to control the iteration from there.

Five Stars

Re: How to use the iterate flow on a tJava 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.