tRunJob: Transmit context to subjob

One Star

tRunJob: Transmit context to subjob

I have a problem with passing context to subjobs. In a controlling job I use tRunJob to call a subjob with "Transmit whole context" activated. I created a context in the controlling job.In the child job, I have done nothing to load the context. When I run the controlling job, the child job which uses a variable from the context reports that the context variable "cannot be resolved or is not a field". Are my settings wrong? I expected that activating "Transmit whole context" in the controlling job would be sufficient?
See my settings in the attached job.
One Star

Re: tRunJob: Transmit context to subjob

You need to have the variable myContextVar defined in both jobs parent and child.
Only the values are transferred to the child job based on the context name match.
Community Manager

Re: tRunJob: Transmit context to subjob

Hi
The effective range of a context variable is limited to the job itself, the child job can't access the context variables of the main job. You need also to define a variable with the same name in child job. If the 'transmit the whole context' box is checked, the value of context variables of the main job will be passed automatically to the context variables with the same name of the child job.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: tRunJob: Transmit context to subjob

Hi Lubod,
Many times creating context variables is tiresome... We can also think of using routine which can be called anywhere in the project. Create simple getter setter routine to get and set the values of respective variables across the project.
Vaibhav
Seventeen Stars

Re: tRunJob: Transmit context to subjob

hi all,
Dont use getter & setter java function Smiley Wink
It's a good way to create some Context Group in Metadata classified "as you want".
The goal is to be able ti use contexte variable when you need it & drag & drop from context group to your job.
Veray easy to create and maintain as anything from repository( metadata).
hope it helps
regards
laurent