One Star

Mix two files inside the same folder, iterating with TFileList

Good afternoon people,
I'm just struggling to develop an idea in Talend Studio, so I guess it's better to ask community and see if you have a solution for my issue!
What I'm trying to do is:
* TFilelist component to read folder contents - it will read only subfolders
   (For example, TFilelist will read folder 201411 and there will be 3 subfolders, 001, 002 & 003)
* Inside each subfolder there are two files that I would like to mix with a tMap component
* I'm trying to deploy two TFileInputDelimited components to read contents of the files I want to mix inside 001 folder, for example
* These TFileInputDelimited components will be used by the tMap component to mix their contents
My issue comes when I try to
A) Iterate twice from TFileList to TFileInputDelimited components --> I cannot join TFileInputDelimited components in tMap
B) If I join TFileInputDelimited components first in tMap, then I can only link one iteration to one TFileInputDelimited

Could you please tell me which is the best way to iterate reading subfolders, and mix two files inside this subfolder (and for every subfolder present) ?
Thank you very much!!!
One Star

Re: Mix two files inside the same folder, iterating with TFileList

Hello - we typically use the tFileList when you don't know how many files or subdirectories you're going to encounter, and you want to process all the contents of a root directory. In you case, it sounds like you know ahead of time what directory will have what file. If that's the case, you're better off specifying your file pathnames to two tFileInputDeliminited to a tMap.

Otherwise, if each subdirectory should have 2 files, you can set up two tFileLists in succession where the first one get a directory and the second gets the subdirectories in that directory. From the second one, you can cycle through and get File1 and File2. You'd then do an iterate from the tFileList1 to a tJava then read File1 and File2 into a tMap....

Best to show what your job looks like (screenshot). And also clarify the question about the assumption above...
One Star

Re: Mix two files inside the same folder, iterating with TFileList

Hi Willm,
Thank you very much for replying my post.
Regarding your question, I don't know the number of subdirectories the job will find, so I need a TFileList to iterate on each one. Inside them there will be always two files already identified, so here I can use TFileInputDelimited as you stated.
My issue comes when I try to set up these TFileInputDelimited after reading each subdirectory. After the tJava component you stated, I'm setting them via OnComponentOk, and after that, trying to mix their main flows into a tMap component.... but tMap only allows me to connect one input, the second is forbidden!
I have attached a screenshot so that my words can be understood better.
Thanks for your time & patience!