Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
asafrian1700127126
Contributor III
Contributor III

Get only one latest file from a folder in tfilelist

I have the following job

asafrian1700127126_3-1726645810259.png

asafrian1700127126_0-1726645630549.png

asafrian1700127126_1-1726645659148.png

asafrian1700127126_2-1726645696196.png

when run it displays 2 files

asafrian1700127126_4-1726645872617.png

 

How to display only the latest WLA file? Just one file.

Labels (4)
1 Solution

Accepted Solutions
marksouzacosta
Partner - Specialist II
Partner - Specialist II

Hi @asafrian1700127126,

There are many ways to do that. This is one:

- Use a tFileList to list all the files. Set the Order By to be By modified date and Order action ASC.

marksouzacosta_2-1726670460428.png

 

- Next Add a tFileProperties, or anything you need, to be executed after the tFileList component is complete. Then use the tFileList Current File Name with path property. This will return the most recent modified file with full path.

marksouzacosta_1-1726670340853.png

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net

View solution in original post

6 Replies
marksouzacosta
Partner - Specialist II
Partner - Specialist II

Hi @asafrian1700127126,

There are many ways to do that. This is one:

- Use a tFileList to list all the files. Set the Order By to be By modified date and Order action ASC.

marksouzacosta_2-1726670460428.png

 

- Next Add a tFileProperties, or anything you need, to be executed after the tFileList component is complete. Then use the tFileList Current File Name with path property. This will return the most recent modified file with full path.

marksouzacosta_1-1726670340853.png

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
asafrian1700127126
Contributor III
Contributor III
Author

I have followed using tfileproperties but it still displays all the files, but sorted by the latest date. What I want is how to display only the most recent file? just one file.

asafrian1700127126_0-1726713036549.png

 

marksouzacosta
Partner - Specialist II
Partner - Specialist II

Hi @asafrian1700127126,

This is what my job is doing. You are getting the wrong relationship between the tFileList and tFileProperties - you are using Iterate, that is why you are listing every single file. You have to call tFileProperties after you execute the whole tFileList component - OnComponentOk - like in my diagram.

Read more at Data Voyagers - datavoyagers.net
asafrian1700127126
Contributor III
Contributor III
Author

Yes it has successfully displayed one type of the latest file using oncomponentok.
I have another question. I want to get the latest xls file to process and insert into the database. Where should I put the tfileinputexcel component? And where should I put the tmap for the excel?

asafrian1700127126_0-1726716877328.png

 

marksouzacosta
Partner - Specialist II
Partner - Specialist II

Great! So, you actually don't need the tFileProperties component there. I added it there just to illustrate the use of the tFilesList_1_CURRENT_FILEPATH property. With that said, you can, for instance, replace the tFileProperties with the tFileInputExcel and the tMap right after that, just like you did before in the first images you sent.

Read more at Data Voyagers - datavoyagers.net
asafrian1700127126
Contributor III
Contributor III
Author

Thank you so much, you are very helpful. I have another question maybe you can help me please visit https://community.qlik.com/t5/Design-and-Development/How-to-read-specific-excel-cells-using-talend/m...