I want to build an HR app that tells me when someone goes on holiday and at the end of each month i can generate a PDF that contains all days in that month.
If someone had a holiday approved that day write 'A' in the PDF table, if that day it was a specific holiday write 'FREE' and if that day its weekend write 'W.E'
So far i have the logic behind holiday approval, i can generate a PDF for a month of my choice that tells me who, holiday period and what type of holiday everyone had during that month. But how can i find the weekend days and fill the specific table cell.
I've attached a photo with the table i want to generate
This really helped and i created my table with it.
Is it a way to get the weekend dates in a month selected from a dropdown box?
Hi @Anonymous ,
How do you list the days within a month in your app? Using Gallery?
Do you want to get all weekend dates within current month?
If you want to get all weekend dates within current month, I have made a test on my side, please consider take a try with the following workaround:
Set the OnSelect property of the "Calculate" button to following:
Clear(WeekDaysCollection);
ForAll(
FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], DateDiff(Date(Year(Today()),Month(Today()),1), Date(Year(Today()),Month(Today())+1,1))),
If(
Weekday(Date(Year(Today()),Month(Today()),1) + Value)=1 || Weekday(Date(Year(Today()),Month(Today()),1) + Value)=7,
Collect(WeekDaysCollection, Date(Year(Today()),Month(Today()),1) + Value)
)
)
then add a Data Table control, set the Items property to following:
WeekDaysCollection
then all weekend dates within current month would be listed within the Data table.
If you want to display the days table as your screenshot mentioned in a canvas app, I afraid that there is no direct way to achieve your needs. As an alternative solution, you could consider add a Gallery control in your app to list all days in current month within the Gallery:
Set the Items property of the Gallery to following:
ForAll(
FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30], DateDiff(Date(Year(Today()),Month(Today()),1), Date(Year(Today()),Month(Today())+1,1))),
Date(Year(Today()),Month(Today()),1) + Value
)
If you want to check if current date is weekend date, you could use the following formula:
If(
"Specific Date Value" in WeekDaysCollection,
"W.E"
)
Best regards,