tFileList with multiple patterns

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 !


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?

View solution in original post


All Replies
Sixteen Stars TRF
Sixteen 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 ...

Sixteen Stars TRF
Sixteen 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?

View solution in original post

Five Stars

Re: tFileList with multiple patterns

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

Thank you for your help !

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog