Five Stars

tFileList with multiple patterns

Hello, I'd like to know if it's possible to manage different file format from a tFileList ?

My situation : a directory with xls, xlsx and csv files (all have the same format).

I want to iterate with tFileList with *.xls, *.xlsx and *.csv patterns and then redirect to a tFileInputDelimited or tFileInputExcel depending on file extension.

 

Thanks for your help !

1 ACCEPTED SOLUTION

Accepted Solutions
Employee

Re: tFileList with multiple patterns

It shouldn't... Unless your filters in the tFileList is not working.  Do you have more than 1 file?

7 REPLIES
Twelve Stars TRF
Twelve Stars

Re: tFileList with multiple patterns

Assuming your tFileList is called tFileList1, check the value of "((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))" to decide which component must be used to read the content of the current file.


TRF
Five Stars

Re: tFileList with multiple patterns

Hi TRF,

From tFileList component I'have to draw an iterate link ... to what kind of component ?

If I draw a "Execute if" link from the tFileList to a tFileInputDelimited and another to tFileInputExcel, there is no more iteration ...

Twelve Stars TRF
Twelve Stars

Re: tFileList with multiple patterns

I've never try this before.

What if you put a dummy tJava after tFileList? Does this also break the iteration?


TRF
Employee

Re: tFileList with multiple patterns

You can link the Iterate to a tJava as a stub, and then draw Run If links from the tJava.  The tJava basically becomes a Stub to draw links from.  But you definitely needs to use iterate from the tFileList

 

Five Stars

Re: tFileList with multiple patterns

Here's what I have done :

tFileList (with my 3 patterns)

  -->iterate

    -->tJava

       -->runIf order#1 ((String)globalMap.get("tFileList_5_CURRENT_FILEEXTENSION")).equals("csv")-->tFileInputDelimited

       -->runIf order#2 ((String)globalMap.get("tFileList_5_CURRENT_FILEEXTENSION")).equals("xls")-->tFileInputExcel

       -->runIf order#3 ((String)globalMap.get("tFileList_5_CURRENT_FILEEXTENSION")).equals("xlsx")-->tFileInputExcel

 

When I run the job, it takes my first file (a csv), call the right branch (open with tFileInputDelimited) and stop !

Seems that iteration stops !

Employee

Re: tFileList with multiple patterns

It shouldn't... Unless your filters in the tFileList is not working.  Do you have more than 1 file?

Five Stars

Re: tFileList with multiple patterns

Your right, I made a mistake ... sorry !

Thank you for your help !