Hello All,
I am currently building an app that allows you to create leave requests. The user must specify from when to when he is on vacation and this is then automatically converted into days (See images).
I have also programmed it to automatically subtract weekends, so to count only Monday to Friday.
But now the company also closes 1-2 times a year. I would like to program the days as well so that when someone selects them, they are not counted as 1 day.
How can I do this? Can I say: "If 28.11.2022 is selected, then count it as no day". Is that somehow possible? If yes, how?
The code behind the day counter (Inputfield: Anzahl Tage):
Thank you in advance.
Solved! Go to Solution.
Thanks so much for your help, @KeithAtherton. But I found an easier way to solve this
I first created a sharepoint list ("Feiertage") with the column heading "Feiertag".
Then I used the following fromula to exclude the weekend and the holidays:
Look! It worked.
I hope I can help others with it. But nevertheless thank you so much for your precious help!
Hi @PowerSäm,
Yes, this is possible if you create a collection containing the closed/holiday dates then count how many closed/holiday dates fall within the date range:
ClearCollect(
colHolidays,
{
HolidayDate: Date(
2022,
11,
1
)
},
{
HolidayDate: Date(
2022,
12,
2
)
},
{
HolidayDate: Date(
2022,
12,
3
)
}
);
Set(
gblDateDiff,
DateDiff(
Date(
2022,
12,
1
),
Date(
2022,
12,
10
),
Days
) - CountRows(
Filter(
colHolidays,
HolidayDate >= Date(
2022,
12,
1
) && HolidayDate <= Date(
2022,
12,
10
)
)
)
);
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Thanks so much for your help, @KeithAtherton. But I found an easier way to solve this
I first created a sharepoint list ("Feiertage") with the column heading "Feiertag".
Then I used the following fromula to exclude the weekend and the holidays:
Look! It worked.
I hope I can help others with it. But nevertheless thank you so much for your precious help!
My pleasure. Thanks for the update, looks like a good solution!
User | Count |
---|---|
253 | |
113 | |
92 | |
48 | |
38 |