Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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"
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.
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.
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"
hi can you add the subfolder name as below
((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\\"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))
@shalla, did it help you?
In this case thank's to mark this case as resolved (Kudos also accepted).
thanku @TRF it is solved