Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to load files from a folder in a specific sequence. I might get more than 1 file in a day. So I need to load the file in a specific sequence only in a loop so that the oldest file loads first and the full process id executed and then and then the subsequent files are loaded one by one.
How can I achieve this. tFileList does not specify the sequence. It randomly picks the file in any sequence but I need to load the files in a specific sequence.
I have loaded the file properties in a table and now I would pull the file name and them loop through it and process it one by one.
What would be the best way to achieve this.
Thanks
Sunil
Then you are almost there. Just read your table with a tdbinput component and connect it to a tFlowToIterate. Then connect an "iterate" to the next step of your job. The example on this page should help:
https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/WqJCkTE5~5DDaSFvtNXZnQ
The following scenario describes a Job that reads a list of files from a defined input file, iterates on each of the files and displays their content row by row on the Run console.
@sunbaj, you need to leverage the order by and order by action properties in tfilelist basic settings.
Thanks for the quick response but that would be very risky. Of all the options available I can only order it by modified date but what if for some reason I have the modified date wrong. I would like to sort it by name but that cannot be done as the file name is in the below format Rpt 2 May 2020, Rpt 20 May 2020 etc..
So is there any other way to achieve this.
I have loaded the files in a table and added a column which has the date field so that the file can be sorted by the date but not sure how to pass the file name in the job in a loop using a sql query
Then you are almost there. Just read your table with a tdbinput component and connect it to a tFlowToIterate. Then connect an "iterate" to the next step of your job. The example on this page should help:
https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/WqJCkTE5~5DDaSFvtNXZnQ
The following scenario describes a Job that reads a list of files from a defined input file, iterates on each of the files and displays their content row by row on the Run console.
Does the file exist? Try the tFileExist. Is the file found?
"C:\Users\su\Desktop\Z\File_To_Process\Revenue 2 Mar 2020"
Attaches is the screen shot.
Not sure why the file component fails.
This is the file path that I pass in file and also in tFileExist1
"C:/Users/su/Desktop/Z/File_To_Process/"+((String)globalMap.get("Name_of_File"))
Add a tJava before the tfileexists with this:
System.out.println("C:/Users/su/Desktop/Z/File_To_Process/"+((String)globalMap.get("Name_of_File")));
What does it show in the console? Is the path and filename correct?
Also, when using the tFileExist, you connect to your ZRR_FILE with an "if" connector, not a OnComponentOk. See the tFileExist help.