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