Four Stars

Spliting a multi-line input message into many rows.

Sorry for what is probably a very noob question.

I've an input message whose body is a multi-line data file, this is routed to a Talend Job, being received as a single String by tRouteInput.

When I pass this to tLogRow is it processed as a single row.

What I want to do is break this row into a sinlee row per line of the input message, but I can't find any components that will do this, so I think I must be missing something very simple.

 

Thanks for any suggestions!

 

Screwtape.

2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Spliting a multi-line input message into many rows.

Hi,

Push this string into a temporary file then read the file tFileInputFullRow to get the content line by line.

Hope this helps.


TRF
Four Stars

Re: Spliting a multi-line input message into many rows.

Inspired by a slightly different solution I found on the the web for duplicating records, I have gone with a tJavaFlex solution, where I break the string into lines and iterate each line. It's not quite kosher, but it works:

 

Main Code:

for ( String strRow : row2.body.split( "\r?\n" ) ) {
	row3.body = strRow;

End Code:

}

I suspect I should increment some counters somewhere to make this a more complete solution, but it will do for now.