Return a value to command line

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

 

Forteen 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

-----------
Fifteen Stars TRF
Fifteen 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
Forteen 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

Forteen 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

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads