Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to pass global variable from child to Master job

Hello,

 

I have a Master job and from that, I am calling a child job using tRunJob component. In my child job, I have a global variable named "ErrorMsg" which has details of any exception if generated in child job. I want to access this "ErrorMsg" global variable with its value even if it's empty or with some error message in Master job. 

 

Can anyone please help me to achieve this in Talend 6.3.1 data fabric 

 

Thanks & Regards

Vikas

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

My reply is based on a solution suggested in this topic,

https://community.talend.com/t5/Design-and-Development/resolved-Passing-Context-Variable-from-Child-...

I tried it and it works fine for my use case.

 

So to start with, in your child job, use a fixed flow component to create a single row with the value of the global Variable and then connect this to a tBufferOutput component.

 

0683p000009Ltfk.png

Once you send this data to tBufferOutput, you can use access this information by using the output link of the tRunJob component in your parent job. Just connect the output link of the tRunJob component to a tJavaRow component and set the values. For example, in the screenshot below, you can do something like -> "context.parentVariable=row1.globalVarValue;" in the tJavaRow component.

Also make sure that the schema of the tBufferOutput in your child job and the tRunJob component in your parent job are the same.

0683p000009LtvT.png

 

Hope it makes sense. I don't think this is an elegant solution but I haven't really figured out a better way to solve this particular problem.

Let me know if you do. Cheers!

 

View solution in original post

3 Replies
Anonymous
Not applicable
Author

My reply is based on a solution suggested in this topic,

https://community.talend.com/t5/Design-and-Development/resolved-Passing-Context-Variable-from-Child-...

I tried it and it works fine for my use case.

 

So to start with, in your child job, use a fixed flow component to create a single row with the value of the global Variable and then connect this to a tBufferOutput component.

 

0683p000009Ltfk.png

Once you send this data to tBufferOutput, you can use access this information by using the output link of the tRunJob component in your parent job. Just connect the output link of the tRunJob component to a tJavaRow component and set the values. For example, in the screenshot below, you can do something like -> "context.parentVariable=row1.globalVarValue;" in the tJavaRow component.

Also make sure that the schema of the tBufferOutput in your child job and the tRunJob component in your parent job are the same.

0683p000009LtvT.png

 

Hope it makes sense. I don't think this is an elegant solution but I haven't really figured out a better way to solve this particular problem.

Let me know if you do. Cheers!

 

Anonymous
Not applicable
Author

Thanks for the detail explanation. It helped me to solve my issue, I had already read about tBuffer component but the problem was in my Master job from tRunJob I was not taking the Main connection to tJavaRow instead I was connecting it to tBufferInput with onComponentOk connection and then from there the Main connection to tJava.

Anonymous
Not applicable
Author

You are welcome. Glad to hear it works.