addDaysUTC(Date,11) - remove weekend days(saturday and sunday)

0
How can we write an expression in change object activity , where it will add the days from a particular date but it shouldn't count the weekend days(saturday and sunday). I used addDaysUTC(Date,11) but how to remove the weekend days from it.
asked
3 answers
7

Hi

Below microflow can address your issue!

A screenshot of a computer

Description automatically generated

if $FindDay = 1 thenaddDaysUTC($CurrentDateandTime, 15)else if $FindDay = 2 thenaddDaysUTC($CurrentDateandTime, 16)else if $FindDay = 3 thenaddDaysUTC($CurrentDateandTime, 17)else if $FindDay = 4 thenaddDaysUTC($CurrentDateandTime, 18)else if $FindDay = 5 thenaddDaysUTC($CurrentDateandTime, 19)else if $FindDay = 6 thenaddDaysUTC($CurrentDateandTime, 22)elseaddDaysUTC($CurrentDateandTime, 23)

 

Hope it help!

 

answered
0

That is not possible out-of-the-box.

You need to create a function addweekdays that takes two parameters, a date x and an integer y, and which will loop y times, each time adding one day, checking if that is weekday, if yes > continue, if no -> add one more day and again checking if that is weekday, if yes > continue, if no -> add one more day. End of loop.

 

Take the resulting date to fill the value in your Change-objectactivity.

answered
0

What do you mean with "where it will add the days from a particular date", are you setting an association to a day object? If so, you could write an OQL (with the OQL module from the Marketplace - https://marketplace.mendix.com/link/component/66876) and use the DATEPART ( WEEKDAY, date_expression ) function. This way, you can quickly retrieve all the day objects which are weekdays.

answered