Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Five Stars

Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Hello,

I am still new to the world of BI and especially Etl Talend, I want to make a display of different data that is in my table between 2 dates that I specify as condition, and that it does not display all the data for all The dates using tMap, i tried to use DateDiff here my condition: TalendDate.diffDate (row4.declarele, '2017-07-20') <= 0 && TalendDate.diffDate (row4.resolule, '2017-07 -25 ')> = 0
But I have this message "Invalid Character Constant".

I do not know what method to use in order to have this data in return.

It's URGENT please.

Fifteen Stars TRF
Fifteen Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

 Hi,

TalendDate.diffDate is expecting to receive 2 dates so you need:

 

TalendDate.diffDate(row4.declarele, TalendDate.parseDate("yyyy-MM-dd", "2017-07-20")) <= 0 &&
TalendDate.diffDate(row4.resolule, TalendDate.parseDate("yyyy-MM-dd", "2017-07-25")) >= 0

Hope this helps.


TRF
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

It does not always work, I think it is not the right function 'diffDate' that can show me the data between the 2 dates. 

 

Another solution please ?!

Fifteen Stars TRF
Fifteen Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

It does.
TalendDate.diffDate gives you the number of days between 2 dates.
Share your tMap (with correction) and tell us what's the result you got (or compilation error if any).

TRF
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Capture d’écran (4).pngCapture d’écran (5).png

Seven Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

please open the code in workspace and you will see a red mark on the right side. click and check the error line and share it with us
Highlighted
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Yea, I use a different form of date but without any result :/Capture d’écran (6).png

Seven Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

date format is different from the data which you have given yyyy-MM-dd
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Always the same problem

 

Capture d’écran (6).png

Seven Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

change 'dd-MM-yyyy' to 'yyyy-MM-dd' in designer -> open tMap editor ,
remember you can't change any code in code panel
Fifteen Stars TRF
Fifteen Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

As said in my 1st answer

TalendDate.diffDate(row4.declarele, TalendDate.parseDate("yyyy-MM-dd", "2017-07-20")) <= 0 &&
TalendDate.diffDate(row4.resolule, TalendDate.parseDate("yyyy-MM-dd", "2017-07-25")) >= 0

Take care of "yyyy-MM-dd" instead of 'yyyy-MM-dd'.


TRF
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

String problem.

 

Capture d’écran (9).png

Fifteen Stars TRF
Fifteen Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

How are declared "declarele" and "resolule" fields?
It looks like they are String datatype but TalendDate.diffDate is expecting for 2 dates parameters.

TRF
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

The fields are declared as Date format

 

Capture d’écran (10).png

Fifteen Stars TRF
Fifteen Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Strange, it should work.

Share the content of the tMap Expression filter.


TRF
Five Stars

Re: Displaying data between 2 dates Introduced by User (URGENT PLEASE)

Capture d’écran (11).png

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch