Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

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

Two Stars

[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?

Accepted Solutions
Highlighted
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

View solution in original post


All Replies
Highlighted
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

View solution in original post

Highlighted
Two Stars

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.
Highlighted
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

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog