Greetings,
I am trying to determine a "Due Date". Based upon a "Project Start Date" and the "Number of days" that type of project allows for it to be worked. I want to exclude weekends and holidays.
I have used many videos and have tried various methods. The simplest being the one show below which will give me a date in the future but doesn't include weekends or holidays, so it falls short.
This is located in the Default function of a field named Due Date:
If(
IsBlank(DataCardValue_FileD.SelectedDate) || IsBlank(DataCardValue_DatePMI.SelectedDate) || !IsBlank(DataCardValue_DateC.SelectedDate),
"",
DateAdd(DataCardValue_FileD,Value(DataCardValue_SelectNoD.Text),TimeUnit.Days
)
)
I have attempted to modify it using the method in this video:
https://youtu.be/QVvhDe6puq0
So, I have added an OnStartup to the App as shown below:
ClearCollect(
colHolidays,
Filter(
Holidays,
Year(HolidayDate) = Year(Now())
)
);
Clear(colDateRange);
ForAll(
Sequence(730,1),
Collect(
colDateRange,
{
RowIndex: CountRows(colDateRange) + 1,
Date: DateAdd(
Today() - 365,
Value
)
}
)
);
RemoveIf(
colDateRange,
Weekday(Date) = 1 || Weekday(Date) = 7 || CountRows(
Filter(
colHolidays,
HolidayDate >= Date,
HolidayDate <= Date
)
) > 0
);
However, I do not know how to modify the top If statement to get the future date from the user input date. Is there anyway to do this since I have done all of the background work to get the dates and the holidays?
Any advice @WarrenBelz @BCBuizer @Ethan_R @mmollet