How to get trunjob label name

Six Stars

How to get trunjob label name

Hi,
How to get the label name of any component in tjava component.
OR

Actually I am using tstatcatcher component to catch the statistics of the sub jobs there I need to know each component lable name and there execution time right now I am getting origin name as tmysqlinput but I want its label name

Please give any suggestion on it

Thanks
Ashish
Community Manager

Re: How to get trunjob label name

Hi
There have been some topics asking the same question, but now, It is impossible to get the component label, as a workaround, you can do some transform on tMap after tLogCatcher like:
tlogCatcher--main--tMap--tFileOutputDelimited
row1.origin.equals("tRunJob_1")?"lable1"Smiley Sadrow1.origin.equals("tRunJob_2")?:"label2":row1.origin)
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: How to get trunjob label name

Hi shong,
Thanks for the quick reply.In my scenario I cant use this because I have more then 15 components in each sub job it will become little bit complicated.IS there any other way at component level

Thanks
Ashish
Community Manager

Re: How to get trunjob label name

Hi
Yes, it is not a good way if there are many components in the job, I would suggest you to report an issue in our bugtracker, our developers will see what we can do and modify the component.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: How to get trunjob label name

There's a nicer solution We've found.
tPreJob -> tFileInputXML -> tSetGlobalVar
in the tFileInputXML I pass the relative path of the item's directory (i.e c:\Talend\workspace\ProjectName\process\)
and the name of the directory in the repository in which my job resides.
FileName = context.items_dir + context.repository_dir + "\\" + jobName + "_" + jobVersion + ".item"
in the XPATH I pass the location of the UNIQUE_NAME and LABEL and pass them to tSetGlobalVar.
key = row1.UNIQUE_NAME + "_LABEL"
value = row1.label.
in tStatCatcher i use tMap and get globalMap.get(row2.origin + "_LABEL").
This gives me the label of the palette each time.
The only thing to remember is that this prejob must be included in each subjob,
the items_dir passes as a parameter to each job, and only the repository_dir changes in each subjob.
When building the job, you need to include the items (it's a checkbox) and then change the items_dir
in the context file.

Hope this helps,