Search code examples
talend

How do I force tJavaFlex to generate multiple rows for a single row


How do I make tJavaFlex generate multiple output rows for a single input row? I don't want to use tSplitRow as I have to do other processing.

But for example, if I add a for loop inside my main code, and split my string into words the below happens, and I just get the last word in the sentence in my output flow:

tRowGenerator generating one sentence (1 row, one column):

enter image description here

tJavaFlex with loop in the Main section splitting the sentence into word tokens:

enter image description here

And this is what I get:

enter image description here

I had thought my loop would generate 10 rows in the output. Is there a way to make the tJavaFlex do this kind of multiplication of input rows?


Solution

  • In order to achieve your requirement, you need to use component tnormalize.

    Below is just a sample job using tNormalize component and I have used the same string that you have used

    enter image description here

    I have provided item separator as "space"

    enter image description here

    I have got the below result for simple println statement

    enter image description here

    Hope this may help you out.