Four Stars

Return a value to command line

HI ,

I have requirement to return the value to console .I mean when i call the job .bat file from command line it should return  a

value..Trying to use t java component  no success.

Reading a value from database and i want to return it to command line.Any suggestion to use which componenet

 

Thanks in advance

Ramesh

 

6 REPLIES
Ten Stars

Re: Return a value to command line

if You need just print message to console, You can use tJavaFlex and code like:

 

System.out.println("Print message - "+row1.col1);

 

Screen Shot 2017-05-03 at 10.09.34 AM.png

Screen Shot 2017-05-03 at 10.09.39 AM.png

-----------
Twelve Stars TRF
Twelve Stars

Re: Return a value to command line

Hi,

You may use tDie with a return code.
In your case, push the result of your select into a global variable, then set the return code using this global variable. It should like:
(Integer)globalMap.get("yourVariable ")

Regards,

TRF
Ten Stars

Re: Return a value to command line


TRF wrote:
Hi,

You may use tDie with a return code.
In your case, push the result of your select into a global variable, then set the return code using this global variable. It should like:
(Integer)globalMap.get("yourVariable ")

Regards,

Yes, it different angle for view

 

all depends how to read:

 

Reading a value from database and i want to return it to command line

tDie - kill Job and return only 1 value, but it could be used in script logic

if value more than 1 and Job must just display value and continue - need print

 

 

-----------
Four Stars

Re: Return a value to command line

Thanks for quick response. I have tried both tjavaflex and tdie components .
when i run in studio i see the value are printing.
when i to run .bat file command line did't get the return values.
do i have do anything to capture return values form command line
here is the output i got
C:\Users\rkacham\Documents\TalendJobs\tes_0.1\tes>cd C:\Users\rkacham\Documents\TalendJobs\tes_0.3\tes\

C:\Users\rkacham\Documents\TalendJobs\tes_0.3\tes>java -Xms256M -Xmx1024M -cp .;../lib/routines.jar;../lib/log4j-1.2.16.jar;../lib/dom4j-1.6.1.jar;../lib/talend_file_enhanced_20070724.jar;tes_0_1.jar; talend_poc1.tes_0_1.tes --context=Default

Ten Stars

Re: Return a value to command line

could You attach some screenshots of Your Job (code)?

 

as You can see from screenshots it work

I normally store output direct to log file, so not often use print to console, but it work

 

Screen Shot 2017-05-04 at 2.01.38 AM.png

-----------
Four Stars

Re: Return a value to command line

Here are the screen shot ,Value is not returning on to console .I have tried in unix and windows.

when i run from studio i do get  retrun value

looks like i am missing some option

Untitled.jpg