Add unique identifer while merging the files

Highlighted
Five Stars

Add unique identifer while merging the files

Hello Friends,

 

I am doing data integration project using Talend. I have a requirement to merge multiple country feeds to one. Every file corresponds to one country, but the file doesn't have any identifier inside the file.

It can be identified by file name which is unique per country. I used tFileList to merge multiple files, but not finding a way to add unique identifier to every file, so that I can identify country on merged feed.

Example:-

en-US, en-CA, fr-CA are the feeds

 

is there a way to do that?

 

Regards,

Mahesh

Community Manager

Re: Add unique identifer while merging the files

When you read the file you will be using a tFileList variable to get the filename and path. You can use 

((String)globalMap.get("tFileList_1_CURRENT_FILE")) to retrieve the filename and then add your identifier column using that data.

Five Stars

Re: Add unique identifer while merging the files

I used tFielList --> tFileInputDelimited --> tFileOutputDelimited.

I see variable ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")), but not seeing any option to add that with expression to new column

Do I need to use any other component in the flow?

 

Forteen Stars

Re: Add unique identifer while merging the files

Hi,

 

you can use tMap or tJavaRow for this, both allow you to add new column and assign a value to it

-----------
Five Stars

Re: Add unique identifer while merging the files

Thank you. tMap worked.

On tMap, I was looking for expression builder on left side columns which is input instead of right hand side columns.

Five Stars

Re: Add unique identifer while merging the files

Thank you tmap worked.

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

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch