Pass One Subjob Global Variable or Context to another Subjob

Eight Stars

Pass One Subjob Global Variable or Context to another Subjob

Hi All,
I am designing a Job where 2 Child Job is present. Subjob1 will be an Audit Job from where a key(number) will be generated from Database Query. I want to pass this key value fiest to Parent Job and then to other Subjobs where audit column will be populated. Can anyone tell me how to achieve this? @TRF, @rhall_2_0, @vboppudi

Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Pass One Subjob Global Variable or Context to another Subjob

Yes, you'll use tBufferOutput from the child job to transmit values to the parent.

The schema associated to the tBufferOutput must be the same for both jobs.

In the parent job, the schema is defined on the tRunJob component.

Also, in this job you need to indicate you want the result propagated from the child to the parent.

You need to go to the tRunJob Advanced Settings tab and tick the appropriate option.

Now, if you want to call an other child job with these values as parameters, connect a tJavaRow after the tRunJob and set the context variables.

The general design should look like this:

 

tSomeComponentOrNot-->
tRunJob (child will return values to the parent)-->
tJavaRow (set the context variables)-->
tRunJob (passing the whole context to the child job)

Hope this helps you to solve your case.


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Pass One Subjob Global Variable or Context to another Subjob

Have a look at this page https://community.talend.com/t5/Design-and-Development/Returning-a-value-from-a-child-Job-to-the-par...
To pass value from parent to child job, propagate context variables.

TRF
Eight Stars

Re: Pass One Subjob Global Variable or Context to another Subjob

Hi @TRF,
Thanks for the nice reply. Just one question so After fetching key value from database i should use tbufferoutput right? Where in toracleinput and tbufferoutput both should be having schema column key. Now in the Parent Job key should be context right?
Fifteen Stars TRF
Fifteen Stars

Re: Pass One Subjob Global Variable or Context to another Subjob

Yes, you'll use tBufferOutput from the child job to transmit values to the parent.

The schema associated to the tBufferOutput must be the same for both jobs.

In the parent job, the schema is defined on the tRunJob component.

Also, in this job you need to indicate you want the result propagated from the child to the parent.

You need to go to the tRunJob Advanced Settings tab and tick the appropriate option.

Now, if you want to call an other child job with these values as parameters, connect a tJavaRow after the tRunJob and set the context variables.

The general design should look like this:

 

tSomeComponentOrNot-->
tRunJob (child will return values to the parent)-->
tJavaRow (set the context variables)-->
tRunJob (passing the whole context to the child job)

Hope this helps you to solve your case.


TRF

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

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch