[resolved] Talend ETL Job Export as Batch file not working

One Star

[resolved] Talend ETL Job Export as Batch file not working

Hello,
I have created one ETL job and when I run it through Talend then it works. The ETL jobs first asks for file to be selected. I have a context variable of type 'File' so when I run job as ETL then it pops up a dialog box which ask to select/browse for file. Now I have exported this ETL job as batch script by following steps from below link,
https://help.talend.com/search/all?query=How+to+build+Jobs&content-lang=en
and
https://help.talend.com/search/all?query=Exporting+a+Job+script+and+executing+it+outside+of+Talend+S...
after exporting when I run the jobName_run.bat file then it does not ask me for file selection i.e. the pop-up to select for file does not come.
can you please guide me on this.
thanks in advance.

Accepted Solutions
Community Manager

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi sunnykokane
Several global vairables are defined on this component,
the full file name is : ((String)globalMap.get("tFileChooser_1_FULL_FILE_NAME"))
the file is : ((String)globalMap.get("tFileChooser_1_FILE_NAME"))
the path is : ((String)globalMap.get("tFileChooser_1_PATH_NAME"))
globalMap on file extention choosed: ((String)globalMap.get("tFileChooser_1_FILE_EXT"))
So, you can pass the file path to tFileInputDelimited or other components by using this global variable after tFileChooser.
((String)globalMap.get("tFileChooser_1_PATH_NAME"))
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi
A custom component called tFileChooser shared by MSSA on Talend exhcange can be used to select a file on-the-fly. Refer to this KB article on Talend Help Center to leanr how to install a custom component into Talend Studio.
http://www.talendforge.org/exchange/index.php?eid=167&product=tos&action=view&nav=1,1,1
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi,
I have same issue here with some of my jobs. I can run them successfully from my local machine and accessing to the data in the production servers, but when I export the ETL job (Build Job option) and I copy it to the production server, the job seems to start but data never is being inserted in the target tables and job never ends. Note that in my local i can run the entire job in a matter of 4/5 minutes. Target tables are located in Redshift.
Also I dont know how I can start debugging this using Talend from command line.
Some help will be appreciated.
Thanks!
Oscar
when exported to shell script is also not working from my local.
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

I have the same problem, try to use logcatcher to get the log of the error.
If you use TOS_DI-win32-x86 (32bits), I think talend will export your job as a 64 bits job and it may cause problems.

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi,
I just tried using the logcatcher but nothing is being captured in the Log. Note that the job never fails, just keeps running forever. Also I tried adding the -Xdebug parameter in the shell script and nothing in being printed.
My local is a mac and server where Im running production is Linux.
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi,
I just tried using the logcatcher but nothing is being captured in the Log. Note that the job never fails, just keeps running forever. Also I tried adding the -Xdebug parameter in the shell script and nothing in being printed.
My local is a mac and server where Im running production is Linux.

You need to use tWarn and tDie to record logs :

I use this to make a log file to know when my job works or not
Change twarn message to : "Success"
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

This is what you should get in your CSV after executing your batch file:
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

Thanks Shong.
Now it is providing prompt for choosing file but how can I pass the file location ??
My previous job (without tFileChooser) was a tFileInputDelimited component and a tJava component.
I use to read file location/file name in a context variable and use to pass that context variable to tJava component , which use to call another java program. My requirement was to tun a job which will ask for file to choose and chosen file location will be passed to another java program. So I created a context variable named "context.WDTF_FILE_LOCATION" of type "File" while creating context file and used that context variable in tFileInputDelimited component. Now when I run job, it ask to choose file and pass file location to third party java program. But problem was when I export this job as batch script and when I run then jobName_run.bat file then it does not ask me for file selection. So how can I use this tFileChooser to catch file location and pass the file location ??
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

Catching of file location as context variable and passing to another java program.
Community Manager

Re: [resolved] Talend ETL Job Export as Batch file not working

Hi sunnykokane
Several global vairables are defined on this component,
the full file name is : ((String)globalMap.get("tFileChooser_1_FULL_FILE_NAME"))
the file is : ((String)globalMap.get("tFileChooser_1_FILE_NAME"))
the path is : ((String)globalMap.get("tFileChooser_1_PATH_NAME"))
globalMap on file extention choosed: ((String)globalMap.get("tFileChooser_1_FILE_EXT"))
So, you can pass the file path to tFileInputDelimited or other components by using this global variable after tFileChooser.
((String)globalMap.get("tFileChooser_1_PATH_NAME"))
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Talend ETL Job Export as Batch file not working

thanks Shong.
Its working now.
Its amazing that Talend is so powerful that it can provide solution to any problem.
Thanks
Community Manager

Re: [resolved] Talend ETL Job Export as Batch file not working

thanks Shong.
Its working now.
Its amazing that Talend is so powerful that it can provide solution to any problem.
Thanks

Glad to see you get it working now, thanks for your feedback.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business