84
Views
5
Comments
Calculate upcoming birthdays from current week

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!

2023-07-31 05-30-45
Siddharth Mukherji

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.

2023-10-26 15-12-53
Mohammed Rizwan

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.


2024-09-12 02-43-38
Deepsagar Dubey

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

2021-09-06 15-09-53
Dorine Boudry
 
MVP

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

2024-09-12 02-43-38
Deepsagar Dubey

Hi Dorine,

Yes developer can ignore the year and can filter from date and month only, I am agreed with you.

Thanks

Deep

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.