One Star

transfer variable between jobs

i hava three jobs what they are job1 ?job2 and prejob which prejob as parent job and job1?job2 as subjob?
i want to define a global variable,where changed in job1 and see the changed value in job2.but now have no idea what to do ,
when i run the prejob ,the job2 can't see the changed value. pls help,thank you!
9 REPLIES

Re: transfer variable between jobs

Make sure you are using Context variables to make the jobs communicate.
Then, make sure in the master job, under the tRunJob component that calls the baby, make sure "transmit whole context" is checked.
if you want to pass variables back out, it gets a little more complicated, but the beauty of Talend is that anything is possible!
One Star

Re: transfer variable between jobs

Make sure you are using Context variables to make the jobs communicate.
Then, make sure in the master job, under the tRunJob component that calls the baby, make sure "transmit whole context" is checked.
if you want to pass variables back out, it gets a little more complicated, but the beauty of Talend is that anything is possible!

when i checked "transmit whole context",i can't get the subjob's change to the context .
for more:
i hava three jobs what they are job1 ?job2 and prejob, i want to define a global variable,where changed in job1 and see the changed value in job2.but now have no idea what to do ,
when i run the prejob ,the job2 can't see the changed value.
Job1:
Community Manager

Re: transfer variable between jobs

Hello All
"transmit whole context" option is used to aslo transmit the value of context var to child job when you export the job script out of TOS, set dynamically the value of context var and run it from command line.(see pic1)
About how to pass a value of variable to child job, see 1918.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: transfer variable between jobs

i have try it ,but when in parent job i can't get the context value changed in subjob.
for the result:

Before ?In Parent??parent 1
tRunJob_1 in preJob1 call demo.subjob1_0_1.subjob1 with:

==============START JOB 1=================================
Before SUBJOB RUNSmiley Tonguearent 1
After SUBJOB RUN: SUBJOB 111
==============END JOB 1=================================
After ?In Parent??parent 1

i want the "After ?In Parent??parent 1" print like "After ?In Parent??SUBJOB 111"
Community Manager

Re: transfer variable between jobs

Hello
You are tring to change context value in parent job and want to pass it to child job, and run the job within TOS, please see 1918. The context var is only valid in the current job, it can't be called/changed in other jobs.
"transmit whole context" option is only avaliable when you export the job script and run it out of TOS as my previous post shows.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: transfer variable between jobs

if you want to pass variables back out, it gets a little more complicated, but the beauty of Talend is that anything is possible!

How is this part achieved?
Six Stars

Re: transfer variable between jobs

In the child job create a flow using the tFixedFlowInput component with the appropriate columns, using variables you wish to pass out as corresponding values. Send this flow to a tBufferOutput component. In the calling job on the tRunJob component select "Copy Child Job Schema" which will copy the schema off the tBufferOutput. Now connect a flow coming out of the tRunJob to a tLogRow to see the rows passed from the child printed in the parent.
One Star

Re: transfer variable between jobs

Thank you @jholman, thanks to you i've resolved my problem Smiley Happy
it works great !
but I also have a question : Is the tBufferOutput is an unical memory ?
Could I use it for several copies ?
One Star

Re: transfer variable between jobs

It's quite late... But I have this same issue, so I did a mini youtube tutorial to explain how to exchange data between talend jobs. Hope it would be useful.
Regards,
Andre Goncalves
http://www.youtube.com/watch?v=k_liM1uO74c