Using global variable in a joblet

Six Stars

Using global variable in a joblet

Hi,
If I want to change the job name per job level instead of 'view' -> 'Label Format', how I can achieve this?
Here I am giving example of tHiveInput, but I have another components from where I want record count.
Here is my problem. I have lot many jobs(100-200) and e.g. tHiveInput component is main driving input, so in some job name is like tHiveInput_1, somewhere it is tHiveInput_<some_number> and I want record count for input and output too.
I have one post job joblet, so I was thinking to apply that logic in joblet so everywhere it will get reflected instead of manually updating 200 jobs. If only one component then I can use 'tHiveInput_1_NB_LINE' but name is not constant in all over the jobs.
how I can achieve this problem?
 
Community Manager

Re: Using global variable in a joblet

Hi  
I think you can use the global variable like this ((Integer)globalMap.get("tHiveInput_"+context.current_component_number+"_NB_LINE")) in the joblet, you need to know how many tHiveInput components are used in each job. To get the number of tHiveinput components, read the jobName_0.1.item file which is located in <studio install dir>/workspace/projectName/process/, and then, iterate each number and populate the global variable ((Integer)globalMap.get("tHiveInput_"+context.current_component_number+"_NB_LINE")).
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business