[resolved] Customizing the unique name of a component

One Star

[resolved] Customizing the unique name of a component

I have some pretty complex Talend jobs designed, and they will involve many tRunJob components, as well as numerous tMySQLInput components, etc. The work will be handed off to be administered by another team.
I am using the log_catcher, stat_catcher, and the error recovery checkpoints features in Talend, and the issue I anticipate is that all of these features rely on references to the components' unique names, and do not include the labels assigned in the TISPE UI.
I have, for example, a job that calls 7 subjobs, with the tRunJob component. Unfortunately, when this job runs, it refers only to tRunJob_1, tRunJob_3, etc., instead of "Populate_Customers" and "Populate_Vendors", which would better inform those that are looking at logs and administering recoveries from failed runs to know what was going on in the job, and where to start the recovery point.
I want to rename the components so that the "origin" fields in the logs and the checkpoint names in the Admin Center reflect the function of the component (e.g. "Populate_Customers"), rather than the generic name (e.g. "tRunJob_2").
An exhaustive internet search has yielded no answers, but I can't imagine I'm the only one with this need, so perhaps I'm (hopefully) missing something simple?

Accepted Solutions
Community Manager

Re: [resolved] Customizing the unique name of a component

Hi
The label does not support the format of context variable or global variable, one solution can be that explicitly transform the component's label on tMap. For example:
tRunJob:_1
|
onsubjobok
|
tRunJob_2
|
onsubjobok
|
tRunJob_3
tLogCatcher--main(row2)--tMap---tMysqlOutput
on tMap, set the expression of origin column of output table like:
row2.origin.equals("tRunJob_1")?"name1":(row2.origin.equals("tRunJob_2")?"name2":"name3")

Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] Customizing the unique name of a component

Hi
You are not the only person who asked for the same request, unfortunately, it is impossible to have a custom name of a component in the log/stat table yet.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Customizing the unique name of a component

Thanks, Shong. Yours have been the most useful responses to other inquiries I've found on this and other subjects.
Is there a way I can refer to the component's label via the globalMap.get() function? That way I may be able to insert the component label in the log message?
Thank you!
Community Manager

Re: [resolved] Customizing the unique name of a component

Hi
The label does not support the format of context variable or global variable, one solution can be that explicitly transform the component's label on tMap. For example:
tRunJob:_1
|
onsubjobok
|
tRunJob_2
|
onsubjobok
|
tRunJob_3
tLogCatcher--main(row2)--tMap---tMysqlOutput
on tMap, set the expression of origin column of output table like:
row2.origin.equals("tRunJob_1")?"name1":(row2.origin.equals("tRunJob_2")?"name2":"name3")

Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Customizing the unique name of a component

That is a clever solution! I think we'll use it! Thanks again, Shong!
One Star

Re: [resolved] Customizing the unique name of a component

I'm so new in Talend and I was looking for some useful way to do the same thing and I ended in the same place: maybe it's not posible Smiley Sad
When I need the origin given by a tLogCatcher, passing the parameters to a tJavaRow, in its code editor, you can use ...

if (((String)input_row.origin).equals("tComponent_1")) {
    globalMap.put("origin", "New_Name_1");
}else if (((String)input_row.origin).equals("tComponent_2")) {
    globalMap.put("origin", "New_Name_2");
}else if (((String)input_row.origin).equals("tComponent_3")) {
    globalMap.put("origin", "New_Name_3");
}else if (((String)input_row.origin).equals("tComponent_4")) {
    globalMap.put("origin", "New_Name_4");
}else if (((String)input_row.origin).equals("tComponent_5")) {
    globalMap.put("origin", "New_Name_5");
}else if (((String)input_row.origin).equals("tComponent_6")) {
    globalMap.put("origin", "New_Name_6");
}else if (((String)input_row.origin).equals("tComponent_7")) {
    globalMap.put("origin", "New_Name_7");
}else {
    globalMap.put("origin", input_row.origin);
}


I hope someone can give us another more elegant option.
Thank you very much
Six Stars

Re: [resolved] Customizing the unique name of a component

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,