One Star

[resolved] Passing global var of date type through tFlowTolterate to SQL query?

TOS 3.2.1, Java Project
I am having difficulty passing global var of date type to SQL query.
Here is sql and I how I thought it should work ...
"select sl_date, sl_store, sl_cat, sl_price
from sales2
where sl_date = '((java.util.Date)globalMap.get("dateKey"))'"
but ... I got errors
- The method ExecuteQuery(String) in the type Statement is not applicable for the for the arguments (String, String)
- Syntax Error on token "dateKey",, expected
This global variable is created by tFlowTolterate component, where I specified "dateKey" variable.
Can you pass date type through tFlowTolterate further on MysqlInput control?
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] Passing global var of date type through tFlowTolterate to SQL query?

Hello guy
try
"select sl_date, sl_store, sl_cat, sl_price
from sales2
where sl_date = '"+((java.util.Date)globalMap.get("dateKey"))+"'"

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
3 REPLIES
Community Manager

Re: [resolved] Passing global var of date type through tFlowTolterate to SQL query?

Hello guy
try
"select sl_date, sl_store, sl_cat, sl_price
from sales2
where sl_date = '"+((java.util.Date)globalMap.get("dateKey"))+"'"

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

Re: [resolved] Passing global var of date type through tFlowTolterate to SQL query?

Shong, thanks bro!!
I guess those + signs are concatenation signs? I don't know anything Java, looks like I'll have to invest into learning it.
Community Manager

Re: [resolved] Passing global var of date type through tFlowTolterate to SQL query?

Hello
I guess those + signs are concatenation signs?

yes!Smiley Wink
Best regards

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