here's my job toracleinput->tsetGlobalVar (key - rundate values "row1.rundate") I need to use the "rundate" from the tsetGlobalVar in all my other jobs. How to do this?
Assuming row1.rundate is a Date then use (Date)globalMap.get("rundate").
However, you can't use globalMap variables from one job in other jobs. You would need to store the rundate as a context variable instead. Replace tSetGlobalVar with tJavaRow and use a statement like context.rundate = row1.rundate;. The check "Transmit whole context" on tRunJob.
I added context.rundate to my existing context file
here's my job
toracleinput->tjavarow(context.rundate = row1.rundate
I tested this job and it works fine.
I did not understand " The check "Transmit whole context" on tRunJob."
Do I need to add this job as trunjob in all the child jobs that need rundate or is there a better way to do this ? like below
JOB_1
trunjob ->onsubjobok ->toracleinput ->tmap->toracleoutput
in toracleinput my query would be "select * from tablename where co_date>context.rundate"
Job_2
trunjob ->onsubjobok ->toracleinput ->tmap->toracleoutput
in toracleinput my query would be "select * from tablename where co_date>context.rundate"
"Transmit whole context" passes all the context variables in the job containing the tRunJob to the job called by the tRunJob.
So your master job would be toracleinput->tjavarow -onsubjobok-> trunjob (job1) -onsubjobok-> trunjob (job2).
Job1 and Job2 would just be toracleinput ->tmap->toracleoutput.
toracleinput->tjavarow -onsubjobok-> trunjob (job1) -onsubjobok-> trunjob (job2).
Job1 and Job2 would just be toracleinput ->tmap->toracleoutput.
The above works
if I create JOB0 as toracleinput->tjavarow
and then create separate master job as below with Transmit whole context" checked it does not pass the value
WHY?
trunjob (job0)->onsubjobok-> trunjob (job1) -onsubjobok-> trunjob (job2).
Because context variables are passed from parent to child not the other way around i.e. if they're loaded in job0, they are not passed back to the master job.
To do so, you need to add -onsubjobok->tContextDump-->tBufferOutput as the last step in job0, then in the master job, copy the child job's schema in tRunJob and pass the flow to tContextLoad before calling jobs 1 and 2.
toracleinput->tjavarow | -onsubjobok->tjava -onsubjobok-tContextDump-->tBufferOutput -tlogrow the context.rundate prints fine in tjava but is null when I see the tlogrow Any ideas?
Yes, sorry, forgot to add that if you set context values manually in a job (i.e. context.rundate = row1.rundate
then you also need the statement context.synchronizeContext(); afterwards for the changed value to be picked up by tContextDump. (If you use tContextLoad, the extra statement is not necessary.)