Child job to update context variable

Five Stars

Child job to update context variable

I need to pass a value from my parent job to the child job, update it and pass it back to my parent job. 

 

I'm okay if this is either through context variable or through global variable.

 

In this scenario, after I transmit the value I force to child job to fail ( tDie). But I still need the updated value in my main job.

 

Can anyone help on how to achieve the same ?

 

 


Accepted Solutions
Sixteen Stars

Re: Child job to update context variable

You cannot do this I'm afraid.

 

You can pass a context variable to a child job easily enough. 

You can pass the value back using a tBufferOutput component at the end of the child job. The value would need to be passed back as part of a datarow.

However, if you kill the child job with a tDie, it ends there and then. Why would you do this? You are essentially killing the Java execution of your program/job. You should only do this if you need the process to stop dead.

 

What you could try is sending the data back to the parent using the tBufferOutput and killing the job after this is done. That might work. The other thing you can try is to write the value out to a database or similar.

 

Unfortunately you cannot pass a context variable back to its parent without going through a convoluted process.


All Replies
Sixteen Stars

Re: Child job to update context variable

You cannot do this I'm afraid.

 

You can pass a context variable to a child job easily enough. 

You can pass the value back using a tBufferOutput component at the end of the child job. The value would need to be passed back as part of a datarow.

However, if you kill the child job with a tDie, it ends there and then. Why would you do this? You are essentially killing the Java execution of your program/job. You should only do this if you need the process to stop dead.

 

What you could try is sending the data back to the parent using the tBufferOutput and killing the job after this is done. That might work. The other thing you can try is to write the value out to a database or similar.

 

Unfortunately you cannot pass a context variable back to its parent without going through a convoluted process.