Limit iteration on tfilelist

Highlighted
Four Stars

Limit iteration on tfilelist

Hello,

 

I have a tfile list component that get files from an ftp directory which contains hundreds files. But i want only one file (the most recent), it is possible to limit the number of iteration of my tfilelist  to only one, instead of hundreds?

 

Thank you for your support

 

 

Eight Stars

Re: Limit iteration on tfilelist

If you select "Order by - Modified date descending" in your tFileList component, then you can then use a tSampleRow to get the first record returned which will be the most recent file.

Six Stars

Re: Limit iteration on tfilelist

Hi,

 

The previous answer is wrong,

 

I had a similar problem and found a trick,

tFilelist ---- Iterate ---- tJava (nothing or logs) ---- Run if (((Integer)globalMap.get("tFileList_1_NB_FILE")) == 1) ----- tFileCopy

For other files, the tFileCopy is ignored.

 

If this helps somebody..

 

Pierre

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