Filtering data on date bases in tmap

Five Stars

Filtering data on date bases in tmap

I have data in source table for 21 September and 22 September but I want to load data into target table only for 21 September .
I am getting an error "invalid character constant" and I have tried all system rountine nothing is working .
Note : "create_date " data type is date "
Can somebody please tell me , how can we filter data on date level in tmap?

Community Manager

Re: Filtering data on date bases in tmap

I assume your dates are stored as dates in your database. If that is the case you cannot filter them as you are trying. You need to filter them as dates or convert them to a String and then filter them using String comparisons (....but not using the == operator). 
Dates are stored down to the millisecond in Java. Since you are filtering using Java, you need to consider this. So if you want to filter out by day (as described) you can either use the Talend date routines to convert the date to a String (only the day part e.g. "yyyy-MM-dd") and using String matching to filter. Or you need to use a between operator to say you want dates that fall between  23:59:59.999 20th September and 00:00:00.000 22nd September.
There are lots of tutorials on this if you Google 
Five Stars

Re: Filtering data on date bases in tmap

Thanks for your reply.
If  I talk about solution ,I can filter out my data in tmysqlinput component in SQL QUERY ( Where condition) .Instead of Converting date into String and again string into date. 
I am looking for very simple solution like filtering  data  based on date in tmap. There will be a way to do as Talend  is based on JAVA .May be I have to build rountine ,that rountine need to call in tmap Smiley Happy
Four Stars

Re: Filtering data on date bases in tmap

In tMap we have function like "GetPartOfDate" in that "DAY_OF_MONTH" pass this value in TalendDate functions by using this function we can get the day from given date.
compare that value to required value.



Talend named a Leader.

Get your copy


Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach


Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.