Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Solving the Informatica Dilemma: On-Demand Briefing - Watch On Demand!
cancel
Showing results for 
Search instead for 
Did you mean: 
Olivier_Pierret
Contributor II
Contributor II

TAlend expression builder - TalendDate for ".CSV" file

Hello, 

I am currently trying to get/copy a daily file ".csv" from a folder.

The original file name is "PES_2025032903202000.csv". and is generated every day.

I want Talend to identify the file based on the string 20250329 (YYYYMMDD).

Can someone tell me which expression to build in the "Expression builder".

 

I have this expression for the moment but it only works if the original file is "PES_20250329.csv"

"PES_"+TalendDate.formatDate("yyyyMMdd",TalendDate.getCurrentDate())+".csv" 

 

Many thanks for your help.


Olivier

Labels (2)
2 Solutions

Accepted Solutions
mchapman
Employee
Employee

I see you are using the tFileCopy component. Try this job design:

mchapman_2-1743429057294.png

 

The tFileList gets the list of files and the Iterate invokes the tFileCopy for each file with the current date.

View solution in original post

Olivier_Pierret
Contributor II
Contributor II
Author

Excellent ! It works fine .
Many thanks for your help

View solution in original post

5 Replies
mchapman
Employee
Employee

If you know the file will always start PES followed by 8 digits for the date, and then any combination of numbers (and letters in this example), you can try this:

"PES_[0-9]*[a-zA-Z0-9]*.csv"

If you specifically want only files with the current date, then this should work for you:

"PES_"+TalendDate.formatDate("yyyyMMdd",TalendDate.getCurrentDate())+"*.csv"

Finds:
[statistics] connected
Date: 20250331
Filename: PES_2025033103202002.csv
Filename: PES_2025033103202003.csv
Filename: PES_2025033103202004.csv
[statistics] disconnected
Olivier_Pierret
Contributor II
Contributor II
Author

Hello, 

I tried "PES_"+TalendDate.formatDate("yyyyMMdd",TalendDate.getCurrentDate())+"*.csv"

Here is the error code i have

PES_20250331*.csv" does not exist or is not a file.
tFileCopy_1 Illegal char <*> at index 75:

kind regards

mchapman
Employee
Employee

mchapman_0-1743428611218.png

Make sure that you have the "Use Glob..." checked as shown in the image.

The syntax is correct. Here is the result:

mchapman_1-1743428701407.png

 

mchapman
Employee
Employee

I see you are using the tFileCopy component. Try this job design:

mchapman_2-1743429057294.png

 

The tFileList gets the list of files and the Iterate invokes the tFileCopy for each file with the current date.

Olivier_Pierret
Contributor II
Contributor II
Author

Excellent ! It works fine .
Many thanks for your help