O'Reilly logo

Talend Open Studio Cookbook by Rick Barton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. Drag a tMap component onto the canvas.
  2. Connect the tFileInputFullRow to tMap, and rename the flow to customerIn.
  3. Open tMap, and create three new outputs. Name them header, detail, and trailer.
  4. Copy the input field line into each of the new outputs.
  5. Add the expression filter customerIn.line.startsWith("00") to the header output table.
  6. Add the expression filter customerIn.line.startsWith("01") to the detail output table.
  7. Add the expression filter customerIn.line.startsWith("99") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required