Spliting a multi-line input message into many rows.

Six 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.

Fifteen Stars TRF
Fifteen 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
Six 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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read