Number in header

Highlighted
Three Stars

Number in header

Hi

 

As many other people I am stugglin with a file that need to have a one digit number in column 1 row 1

 

      2

  name1 :  name 2  : name 3

 

Number 2 tells the program which this file is going to be imported to which place this data should be saved on. 

 

Is there a way to solve this in any way?

I was thinking of adding another tfileinputdelimited with just the number 2 in it, is this possible?


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Number in header

Try this in your tMap (not tested):

tMap_3.png

Then reuse Var.var2 to populate your output field.


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Number in header

You need to access the file twice:

- 1rst time with no header and limit set to 1 to get just the 1rst record and save its value somewhere (a global variable for example).

- 2nd time with header set to 1 to get the file content except the header line and then you go with the rest of the job


TRF
Three Stars

Re: Number in header

Many thanks TRF for fast reply, will test and revert back

Three Stars

Re: Number in header

Came up with this solution in my tFileOutput which adds the number I want, the drawback is that it adds it on every row.

 

What should I write in the Var expression field to make it stop after first row? Please find attached files 

 

"2\n" + row1.ISIN

Fifteen Stars TRF
Fifteen Stars

Re: Number in header

Try this in your tMap (not tested):

tMap_3.png

Then reuse Var.var2 to populate your output field.


TRF
Three Stars

Re: Number in header

Problem solved! Many thanks TRF, some minor adjustments made and the thing worked!scrnsht3.PNG

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog