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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem in tFileList

hello All..

I have a folder having many sub folders. Each sub folder have a single file having the same name.

for example only one folder then 100 sub folders and each sub folder has a file so total 100 files and name is same for all files like "file.xml" 

i have designed a job which is coverting xml files to json

tFileList--tFileInputXML--tMap-- tWriteJsonField-- tFileOutputDelimited

now the  problem is as it should processed 100 files but as output i am getting only one output file.It may be because all files have the same name.

Please tell me the solution what should i do so that i can get all 100 Jsons (desired output)

please help me as soon as possible.

Labels (4)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You  need to extract it from the "CURRENT_FILEDIRECTORY" global variable associated to the tFileList using the substring method.

Based on the previous example, it should look like this:

"File_"+
((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).
substring(((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).
lastIndexOf("\\")+1)+
".xml"

View solution in original post

6 Replies
TRF
Champion II
Champion II

Hi,

You may include the file number issued from tFileList into the output filename like this:

"file_" + ((Integer)globalMap.get("tFileList_1_NB_FILE")) + ".xml"

This suppose the output filename is constructed into the tFileList iteration.

Hope this helps.

Anonymous
Not applicable
Author

hey thanku so much..

now its working fine...but how can i add the sub folder name instead of file number in the output file name.

 

TRF
Champion II
Champion II

You  need to extract it from the "CURRENT_FILEDIRECTORY" global variable associated to the tFileList using the substring method.

Based on the previous example, it should look like this:

"File_"+
((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).
substring(((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).
lastIndexOf("\\")+1)+
".xml"
Anonymous
Not applicable
Author

hi can you add the subfolder name as below

 

((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\\"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))

TRF
Champion II
Champion II

@shalla, did it help you?

In this case thank's to mark this case as resolved (Kudos also accepted).

Anonymous
Not applicable
Author

thanku @TRF it is solved