[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.
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
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
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.
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.
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