Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 !!
Labels (3)
3 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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