Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to create the 2 sqls. In first sql my output will be the last runtime of the Table and in another sql I want to feed this output as input for 2nd sql. I am trying to pass the variable through Tflow to iterate component. But here it is taking the default date (Java.util.date) as the input to my second sql and getting the error as invalid relation operator.
I need to pass the date format as "dd-MMM-YY hh:mm:ss:ssz" in the second sql but whereas from the tflow to iterate component giving the dateformat as "Mon Apr 08 22:00:06 IST 2019".
Please suggest how to fix this in flowto iterate component and provide the suggestion on if any other component is there to iterate the values ?
Hi
you cannot connect direct to tDBOutput, and you cannot update in tDBInput
but you can:
- connect tDBInput to tDBOutput for update
- use tDBRow instead of tDBOutput, the you can run any query UPDATE/DELETE and etc
Hi,
you could format date to formatted string and use it in the query instead of date
TalendDate.formatDate("dd-MMM-YY hh:mm:ss:ssz",myDate)
so, query will be like:
(edited)
"SELECT .... FROM ... WHERE DateCol = '"+TalendDate.formatDate("dd-MMM-YY hh:mm:ss:ssz",(Date)globalMap.get("row1.dateCol"))+"'
oh, sorry
I answer without a computer, so of course, make a mistake
my variant must be like:
"SELECT .... FROM ... WHERE DateCol = '"+TalendDate.formatDate("dd-MMM-YY hh:mm:ss:ssz",(Date)globalMap.get("row1.dateCol"))+"'
but in case if you iterate over string - you can use just :
"SELECT .... FROM ... WHERE DateCol = '"+(String)globalMap.get("row1.dateCol")+"'
if your String variable not in a proper format - then you need first:
- parse String to Date using your original string date pattern
- format Date to String using standard (expected) date pattern
don't look for tLog row - it just prints default date format,
tFlowToIterate support all formats, so you can send data as Date
tDBInput1 -> tMap (parseDate from String) -> tFlowToIterate -> tDBInput2 (there use formatDate from (Date)globalMap.get()))
1) IF your source column is already date (don't worry about the pattern, just must be defined as Date) - just go to step 3
2) if your source column is String
tMap after tDBInput1 - you MUST use proper pattern which you have in source String
TalendDate.parseDate("EEE, d MMM yyyy HH:mm:ss Z",row1.dateCol)
good link for test - http://www.sdfonlinetester.info/#
3)
tDBInput2 (below your original format)
"SELECT .... FROM ... WHERE DateCol = '"+TalendDate.formatDate("dd-MMM-YY hh:mm:ss:ssz",(Date)globalMap.get("row1.dateCol"))+"'