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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Dynamic Variable

Hi,
I am new to Talend. Can someone explain me the steps involved in passing a dynamic variable to a query using talend. From step 1 to step N if possible. I am not able to do so. I basically want to use a date pulled out from one table and use that in a query. The query should be able to dynamically carry the variable value as the date may change in the parent table. Please help
TIA
Labels (2)
2 Replies
Anonymous
Not applicable

Easy to do:
2 ways to do: use context variables or the globalMap (only accessible within the job).
1. create a context variable (e.g. country as String type)
2. add the database component to your job and add the query (at first with a fix value)
"select ID, sum(revenue) from country_rev where country_name='USA'"
3. now change the query to use your variable:
"select ID, sum(revenue) from country_rev where country_name='" + context.country + "'"
4. If you have your value in the globalMap here is the necessary query:
"select ID, sum(revenue) from country_rev where country_name='" + globalMap.get("country") + "'"
Talend only supports plain text replacements for the query in input components.
You can also consider using the *row components, these comps supports prepared statement parameters.
_AnonymousUser
Specialist III
Specialist III
Author

How to pass the value of the variable to the global variable?????