Hi all ,
Thanks in advance,
generally - same as You run it from command line
for example in case of windows
it will be
"cmd /c cscript your file.js"
in case of Mac it will be
Thanks. Am able to run the js file using the command in tsystem as u mentioned , but my issue is to return a value from the js function to any other component or job in talend. I used "echo" statement to throw the value , it worked .But i want to get the return value from the js function into my talend job.
Thanks in advance ,
tSystem have settings for store Standard Output and Error Output - Console and/or variable
Enable store to variables, and in case of standard output - check
Thanks. I used ,
in tjava component after writing the necessary file details in tsystem , it thrown me 'null'. Can you elaborate the method to get the value from js file a bit in detail ?
var getValues = WScript.Arguments; return "The merged values are:"+getValues(0)+"-"+getValues(1)+"."; } test();
This is the sample code on my JS file .
"cmd /c cscript samplefile.js \"test\" \"run\""
This is the code on my tsystem .
this is execution of You example in windows CMD shell
Why You expect anything other than null, if Your script return null :-)
tSystem catch output, but Your script do not have it
I have checked the option to store the tsystem output to global variable , still it throws null. If my method throws null ,what is the correct method to store the tsystem's output in a variable and how to use it in tjava or any other component ? Thanks , Praveen M.
You have some misunderstanding - Your function return information into main part of Your script, but Your script do not return anything to OS console!
tSystem store into variable or on console - Standard or Error Outputs
So for store something need to have this something :-)
My picture it is result run of Your script without talend - just under windows command line ...
because Your script do not send to Output any information ( == print), Talend nothing to store into variable
Thanks , i understand it now.
So how should i write to OS Console from my .Js file ?
I tried using echo , it does not work. Also what should be the code on t_java component to get the value from .js file
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Pick up some tips and tricks with Context Variables
Learn how media organizations have achieved success with Data Integration
Create systems and workflow to manage clean data ingestion and data transformation.