Reading headers and trailers using tMap
This recipe shows how to parse a file that has header and trailer records, and a record type at the start of a line.
Getting ready
Open the jo_cook_ch08_0060_headTrailtMap
job.
How to do it...
The steps for reading headers and trailers using tMap
are as follows:
- Drag a
tMap
component onto the canvas. - Connect the
tFileInputFullRow
totMap,
and rename the flow tocustomerIn
. - Open
tMap,
and create three new outputs. Name themheader
,detail
, andtrailer
. - Copy the input field line into each of the new outputs.
- Add the expression filter
customerIn.line.startsWith("00")
to the header output table. - Add the expression filter
customerIn.line.startsWith("01")
to the detail output table. - Add the expression filter
customerIn.line.startsWith("99") ...
Get Talend Open Studio Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.