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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
pawe84
Creator
Creator

tDBInput, where condition context variable date issue

Hi everyone

I tried to add a context variable "Start" which is a date type.
If I start my talend job I'm able to choose a date but after that there are always errors.

 

0683p000009M7RT.png


Can't figure out how solve this issue


This is my example query:

 

select invno 
from invoicedata

where convert(date, invoicedata.invno,104)=convert(date,(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",context.Start) ),104)

 

Thanks for any advice. 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Is the code you have shown what is in your DB component? You need to keep in mind that the SQL you put in your component is actually a Java String. So you need to build it like a Java String. For example, if you want to add a context variable to a WHERE Clause, you need to do something like below....

 

"SELECT
MyColumn1,
MyColumn2,
MyColumn3,
MyColumn4
FROM MyTable
WHERE MyColumn1 = '"+context.MyParam+"'"

The assumption above being that the data type of MyColumn1 and context.MyParam is String.

View solution in original post

1 Reply
Anonymous
Not applicable

Is the code you have shown what is in your DB component? You need to keep in mind that the SQL you put in your component is actually a Java String. So you need to build it like a Java String. For example, if you want to add a context variable to a WHERE Clause, you need to do something like below....

 

"SELECT
MyColumn1,
MyColumn2,
MyColumn3,
MyColumn4
FROM MyTable
WHERE MyColumn1 = '"+context.MyParam+"'"

The assumption above being that the data type of MyColumn1 and context.MyParam is String.