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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
daez
Creator
Creator

Sort FTP files using dates

Hello everyone,

Sorry for my english skills, my java skills & my Talend skills that is all pretty new to me & I'm learning everyday here.

I'm currently working on something that I have no idea how the best I should start on. I have an FTP access where they will be files which are named like "TEXT_yyyyMMdd_hhmm". I have to sort get the latest files (so sort by alphabetic I guess?), do some data transform (xml to csv, new column ... = tMap?) then load back on the FTP the files and delete only the oldest.
So if i have :

1. TEXT_20180506.xml
2. TEXT_20180504.xml
3. TEXT_20180508.xml
4. .....
I want to only get the TEXT_20180508.xml , put it in a Tmap & output it on the same FTP with .csv . And once its done, delete the oldest one (TEXT_20180506.xml).

 

What should be the best way ?

I can only think of tftpconnection > tftpget > tmap (+java code) > outputdelimited but I dont feel it.

Looking for advices; Thanks !

 

 

Labels (1)
16 Replies
daez
Creator
Creator
Author

Thanks @manodwhb , Now i get 2 files with my tFTPGet. But I dont see any order/sort possibilites with my settings on tFTPFileList. So it doesnt order at all and my tFileInputXML return a "null" for :  (String)globalMap.get("tFileList_1_CURRENT_FILEPATH") .

 Here is a screenshot : 

0683p000009LxYh.png

Thanks !

manodwhb
Champion II
Champion II

@daez,you should use tFilelist not tFTPFileList

manodwhb
Champion II
Champion II

@daez,please find the below after the first file has processed you need to abort the job since this way.

instead of  tJava place,you should use your logic to convert xml to csv.

 

0683p000009LxZ0.png

daez
Creator
Creator
Author

@manodwhb , Oh my bad I thought it was FTPFileList. Its now working all fine, thanks a lot !

 

 

 

manodwhb
Champion II
Champion II

@daez,please accept solution and also provide Kudos

daez
Creator
Creator
Author

@manodwhb, Yes i was about to do that, i just didnt see your last post before i reply, why should I add a tdie? 

I added a tdie after my tFileOutput with the link " on component OK " but I have no "iterate " row like yours, I dont understand what it does.


manodwhb
Champion II
Champion II

@daez,if you do not want to iterate use tdie.otherwise do not use.