Search code examples
javatalend

Talend : get the name of the file of tFileInputDelimited in tSystem


I am trying to invoke a java program I built inside Talend. One of its argument is the name (or path\name) of the TSV file it will be working on. So, I did this Job:

job

With the tFileInputDelimited looking like this:

tFileInputDelimited

And the tSystem looking like that:

tSystem

Basically, I need to run the following command in tSystem:

"java -cp * tsvTranspositer.TSVTransposer " + fileName

With fileName being the Name (path) of the precedent tFileInputDelimited But the fileName variable doesn't seem to be callable (as seen on the last screenshot) while I have been told it was. How can I access it from inside tSystem?


Solution

  • No need to read the file, you need just to pass the file name to the tSystem component using a tFileList

    tFileList-----(iterate)----->tSystem
    

    In tSystem component, concatenate the global var to your command:

    "java -cp * tsvTranspositer.TSVTransposer "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
    

    By this way, your job will iterate over all your input files.