Hi sir, I want to filter a data in aggregates that will display upcoming birthdays within this current week. I'm not so sure about the syntax of how to use dayofweek(), is there any better functions for this?Thank you!
You can easily get the required result by applying filter in aggregate. You can also read about
DayOfWeek: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Date_and_Time#DayOfWeek
It returns an integer indicating the day of the week: 0 to Sunday.
Hello J De Mesa ,
You can get birthdate of employee of this week by applying simple filter in aggregate.
Employee.DateOfBirth>=CurrDate() and Employee.DateOfBirth<=DateTimeToDate(AddDays(CurrDate(),7))
I hope this helps.
Best Regards,
Rizwan.
Hi @J De Mesa,
I created a date range which always give you current week dates, start fro Sunday and end to Saturday, Just copy below expression and put start date as week start date in your aggregate and put end date as week end date in your aggregate
"Start - " + AddDays(CurrDate(), - DayOfWeek(CurrDate())) + " End - " + AddDays(CurrDate(), (6 - DayOfWeek(CurrDate())))
So, your filter looks like Employye.DOB >= AddDays(CurrDate(), - DayOfWeek(CurrDate())) and Employye.DOB <= AddDays(CurrDate(), (6 - DayOfWeek(CurrDate())))
I hope it'll solve your issue.
Thanks
Deep
this is going in the right direction, but if DOB is date of birth, i.e. in some date years ago that the person was born, this will only work for people born this year.
So you'll need some juggling with stripping the year before comparison.
Here's a possible way :
Dorine
Hi Dorine,
Yes developer can ignore the year and can filter from date and month only, I am agreed with you.