Get data with more than a week

Get data with more than a week

  

Hi guys!


I am trying to create a filter to get data with more than a week to a table, i mean, all content created before that, but i am not getting there. 



Any help will be good!

Cheers



Hi,


It would help us a lot if you provide us with the aggregate you are struggling with.


Hi Gatts,

You would use the AddDays() built in function passing in your date and -7 to go back a week.

So something like Assistencia.Data < AddDays(CurrDate(), - 7)

Let me know if you have any trouble,

Justin

Yeah, i tried that before too.

But the < operator cannot work with date or datetime.


Tks!

I use the > and < comparators with dates all the time. What leads you to think this doesn't work?

Error

http://tinypic.com/view.php?pic=1nyau9&s=9#.WPd0VdLythE


Sry if i am doing this wrong.


Tks for the help!

Solution

That error is because you are trying to compare a Date to a DateTime, so you need to convert the date time to date using the built in function 'DateTimeToDate()'

DateTimeToDate(AddDays(CurrDate(), -7))

Let me know if you have any other troubles,

Justin

Solution

It worked!


Really helpfull Justin, tks a lot!

I have created below filters & it is working perfect :)

Notifications is my Local Table:


Today:
Notifications.notification_date = FormatDateTime(CurrDate(),"yyyy-MM-dd")


Last Month:
Notifications.notification_date >=
NewDate(
If(Month(CurrDate()) =1,Year(CurrDate())-1,Year(CurrDate())),
If(Month(CurrDate())-1 > 0,Month(CurrDate())-1,12),
1)
and
Notifications.notification_date < NewDate(Year(CurrDate()),Month(CurrDate()),1)


LAST WEEK:
Notifications.notification_date >= NewDate(Year(AddDays(CurrDate(),-DayOfWeek(CurrDate()))),Month(AddDays(CurrDate(),-DayOfWeek(CurrDate()))),Day(AddDays(CurrDate(),-DayOfWeek(CurrDate()))))



Thanks,

Assif