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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filter a Date field: from today to 30 days before

Dear all,

i have to send a report .csv everyday considering the current date and the 30 days before the current date. How can i do that?

i have obviously a date field in that format "yyyy-MM-dd" and i need to filter that field every day.

 

to make an example i have to send the report tomorrow (2018-05-19) and in the report there will be data from (2018-05-19 - 30 days) and 2018-05-19.

 

thanks in advance   

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Use a tFilterRow or tMap or if your data come from a database, build a where clause based on the global variable.
You may be inspired by this link about compareDate
http://whateverybodywantsis.blogspot.fr/2017/02/talend-compare-date-function-examples.html?m=1

View solution in original post

3 Replies
TRF
Champion II
Champion II

You may set a global variable with the current date - 30 days using tSetGlobalVar: TalendDate.addDate(TalendDate.getCurrentDate(), -30, "MM")
Then use the variable to filter your input rows using the TalendDate.compareDate routine.
If your input is a database, I suggest you to build a where close using the result of TalendDate.addDate to select only the desired rows.
Anonymous
Not applicable
Author

thanks for the answer,

but, where i have to put the "variaible to filter your input rows"? 

and specifically how Talend.Date.compareDate works?

 

 

TRF
Champion II
Champion II

Use a tFilterRow or tMap or if your data come from a database, build a where clause based on the global variable.
You may be inspired by this link about compareDate
http://whateverybodywantsis.blogspot.fr/2017/02/talend-compare-date-function-examples.html?m=1