tFileInputDelimited dynamic filename

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>
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.
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.

Six Stars

Re: tFileInputDelimited dynamic filename

Use the below code -

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

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