Sushant Vasishta
Sushant Vasishta

Reputation: 174

Talend - Passing globalMap variables to all the subJobs in a Job

Passing globalMap variables to all the subJobs in a Job I am working with multiple jobs that share 60% of same code. Every time I've to update something, I end up changing same stuff in all the jobs.

Here is how it looks:

Existing Job 1 - Node ETV -> Node 1 -> Node 2 -> Node 3 -> Node ABC -> Node 5 -> Node 6

Existing Job 2 - Node KJL -> Node 1 -> Node 2 -> Node 3 -> Node MNP -> Node 5 -> Node 6

Existing Job 3 - Node LDG -> Node 1 -> Node 2 -> Node 3 -> Node XYZ -> Node 5 -> Node 6

I want to make them all work like:

Create Sub Job 1, which is combination of Node 1 -> Node 2 -> Node 3

and

create Sub Job 2, which is combination of Node 5 -> Node 6

And then rewrite the jobs as following:

Updated Job 1 - Node ETV -> Sub Job 1 -> Node ABC -> Sub Job 2

Updated Job 2 - Node KJL -> Sub Job 1 -> Node MNP -> Sub Job 2

Updated Job 3 - Node LDG -> Sub Job 1 -> Node XYZ -> Sub Job 2

The issue is, apparently the scope of globalMap is limited and in no way it is 'global'. The values created in Node ETV aren't accessible within Sub Job 1. Can't seem to get past this thing. There must be create variables which are accessible everywhere within the job.

Upvotes: 0

Views: 1228

Answers (1)

Corentin
Corentin

Reputation: 2552

You can use context variables instead of global variables. When you use tRunJob to call your subjob, you can check the option "transmit whole context" . This way your subjob will automatically retrieve context values from the job. You'll just have to declare your context variables with the same name in all the jobs.

Upvotes: 0

Related Questions