Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Set value dynamically to global context variable from job

I want to set a value dynamically to global context variable from a job which should be effected for all jobs.
Then I want to use this dynamically assigned global context variable value in other job.
How to set value from a job which can be retrieved from other job
I created a global context group variable with null value and using tJava component I have assigned a value to the context variable like context.variable="reassignment". but when I'm retrieving this global context variable in other job, it is showing null/no value.
Thanks in advance.
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This is not possible using any of the variable inside talend, in order to do you have to have some work around
- you can either store that value in some text file or
- You can save that value to database table
Vaibhav

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi,
Context variables flows in water fall model i.e. top to bottom, but they can't climb up... you will either have to use routine variables or hash map to get it to top or climb up from child to parent job...
Getter setter routines are good to use but need to be very careful about their initialization
- Another approach is to use tbuffer component to pass values to parent from child using schema
- when you want to send context variables to child, you have to enable check box to send context down..
- you can also set the values of context to child context using setting parameters in tRunJob
Vaibhav
Anonymous
Not applicable
Author

Thanks for your reply sanvaibhav.
Actually I  am re-running the same job (contains only tJava) now I am retrieving the previously assigned value and printing to console, at this time I am getting null value.
Anonymous
Not applicable
Author

are you still getting null value???
>> at this time I am getting null value.

Vaibhav
Anonymous
Not applicable
Author

Yes
Anonymous
Not applicable
Author

Hi,
Have you checked document about TalendHelpCenter:Can I define a variable that is accessible from multiple Jobs?
Best regards
Sabrina
Anonymous
Not applicable
Author

Yes Sabrina, I have checked, but there two child jobs are calling one by one from the parent job, but my task is not like that. I have to run the same job again(re-running/again pressing F6) but this time I am trying retrieve the previously assigned value, but it is not getting the previously assingned value but a null.
Is there any way to set a value dynamically to some globally accessing variable which has to access to the job when I run the same job again.
Anonymous
Not applicable
Author

This is not possible using any of the variable inside talend, in order to do you have to have some work around
- you can either store that value in some text file or
- You can save that value to database table
Vaibhav