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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Nikko
Contributor
Contributor

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 !

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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

View solution in original post

7 Replies
TRF
Champion II
Champion II

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.

Nikko
Contributor
Contributor
Author

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 ...

TRF
Champion II
Champion II

I've never try this before.

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

Anonymous
Not applicable

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

 

Nikko
Contributor
Contributor
Author

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 !

Anonymous
Not applicable

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

Nikko
Contributor
Contributor
Author

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

Thank you for your help !