Retrieving GlobalVar setted in a tSetGlobalVar

One Star

Retrieving GlobalVar setted in a tSetGlobalVar

Hi,
I try to understand how the tSetGlobalVar works.
I've created a job for testing (see fig1), with
- a tFileInputProperties reading a properties file with 2 couple (key, value) : "chargement.vip.mode=load-after" and "chargement.vip.date=25-11-2009"
- a tSetGlobal var using the main row to set 2 var in the globalMap
- a tJava that prints to 2 globalMap var in the console

When i see the generated code for the tSetGlobal, i can see that :
globalMap.put(row6.key, row6.value);
So in the tJava, i try to retrieve the value i put :
System.out.println("Mode chargement -test : "+(String) globalMap.get("chargement.vip.mode"));

Then i execute : the value displayed is null !!
I tried to connect the tSetGlobalVar to a tLogRow, and when i do that the console displays :
chargement.vip.mode|load-after
chargement.vip.date|25-11-2009
So, how can i do to retrieve in my tJava and in my other component such as the tMap, the values setted in the tSetGlobalVar component ??
I join screenshots.

Thanks in advance !!
Community Manager

Re: Retrieving GlobalVar setted in a tSetGlobalVar

Hello
So, how can i do to retrieve in my tJava and in my other component such as the tMap, the values setted in the tSetGlobalVar component ??

On the next subjob, you can get the value of global variable on other component such as tJava, tMap.
for example:
tFileInputDelimited---main-->tSetGlobalVar
|
onSubJobok
|
tJava
on tJava:
System.out.println("Mode chargement -test : "+(String) globalMap.get("chargement.vip.mode"));

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Retrieving GlobalVar setted in a tSetGlobalVar

hi

I am trying to use the set global variable "myKey" in the place of tFileinputdelimited Field Separator part
but im getting the following error
"Parameter can't be null."
but the value is set properly . how to use "myKey" in this component
Community Manager

Re: Retrieving GlobalVar setted in a tSetGlobalVar

Hi naranibhanu
Please describes your problem with more details, a screenshot of your job is helpful for us to address the issue. It is better to open a new topic for your problem, it is more easy for us to follow up the topic.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business