tFileInputDelimited dynamic filename

Highlighted
Four Stars

tFileInputDelimited dynamic filename

<p>Hello, how to pass parameter filename to tFileInputDelimited?</p>
<p>I have to parse a file that changes daily, the filename format is <strong>somefile_yyyymmdd.csv</strong></p>
<p>So every day it will have different name</p>
<p>&nbsp;</p>
<p>In tFileInputDelimited, I have to select the file manually?</p>
Highlighted
Moderator

Re: tFileInputDelimited dynamic filename

Hello,

Could you please try to use a tFileList component to iterate your somefile_yyyymmdd.csv file in a given directory based on a file mask pattern?

tFileList(*.csv)-->tfileinputdelmited(((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) )-->output

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Five Stars

Re: tFileInputDelimited dynamic filename

Hello,

Depends on when you want to parse it.

If it's the same day you can use in the file name :

"somefile_" + TalendDate.getDate("yyyMMdd") + ".csv"

If you want to parse it one every week, use a tFileList then iterate into a tFileInputDelimited.

 

Hope it'll help.

Highlighted
Six Stars

Re: tFileInputDelimited dynamic filename

Use the below code -

((String)globalMap.get("tFileList_1_CURRENT_FILE")).replace(".csv","")+"_"+TalendDate.getDate("yyyyMMdd")+".csv"

2019 GARTNER 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

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog