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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Using the same name for a variable in multiple components

Hello,

I have a job which uses multiple tJavaRow components. I would like to use the same variable names in each component. However, they should point to the variable as defined in that component, is that possible? If I recreate the same variable name I get the error "Duplicate Local Variable".
Thanks,
Doug

Labels (2)
6 Replies
Anonymous
Not applicable

Hi,
You can define a context variable and use this variable on different/multiple components.
[font=Verdana, Helvetica, Arial, sans-serif] For more information, please take a look at document about:TalendHelpCenter:Using contexts and variables.[/font]
[font=Verdana, Helvetica, Arial, sans-serif] Best regards[/font]
[font=Verdana, Helvetica, Arial, sans-serif] Sabrina[/font]
_AnonymousUser
Specialist III
Specialist III
Author

Thanks for that. If I use that context variable in each component, can I assign different values to that variable per component?
Anonymous
Not applicable

You can also use global variables ( same as in java) but these are local to the job 

Syntax is globalMap.get("X") ,  globalMap.put("X","")
Anonymous
Not applicable

Hi,
The tcontextLoad/ Implicit context load is used to load value of context variable from properties file.
Here is a related scenario in component reference:TalendHelpCenter:tContextLoad.
Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III
Author

ds123 wrote:
Thanks for that. If I use that context variable in each component, can I assign different values to that variable per component?

if I create a context variable I have 1 variable throughout my job. I want one variable per tJavaRow component, of which the scope is limited to the tJavaRow component. the context variable's scope is job-wide, right?
_AnonymousUser
Specialist III
Specialist III
Author

ds123 wrote:
xdshi wrote:
Hi,
You can define a context variable and use this variable on different/multiple components.
[font=Verdana, Helvetica, Arial, sans-serif] For more information, please take a look at document about:TalendHelpCenter:Using+contexts+and+variables.[/font]
[font=Verdana, Helvetica, Arial, sans-serif] Best regards[/font]
[font=Verdana, Helvetica, Arial, sans-serif] Sabrina[/font]

if I create a context variable I have 1 variable throughout my job. I want one variable per tJavaRow component, of which the scope is limited to the tJavaRow component. the context variable's scope is job-wide, right?

Any ideas on this one?