How to select last working day?

Hello Guys,

How do I get last working day from today date.

Bot will run mon to Friday in between holiday will be come
For example today. Is Tuesday and bot should be get Friday date bcz it’s working day.

I have holiday sheets

How I can implement for this scenario.

Thanks

Read range your holiday sheet, then use look up datatable to check if Date.Now is in your holiday sheet. If it is then bot do nothing as it is a holiday.

Please check the below documentation if you want to update your calendar on orchestrator

Orchestrator - Managing Non-Working Days (uipath.com)

Can you please elaborate more as today is Tuesday so the Robot should work for today as your working week is Monday to Friday. Let me know if i understand your question or not.

How do we select last working day.

For example today is Tuesday and my condition is t-1 but Monday was holiday so bot should take working day means Friday

Saturday and Sunday is already holiday

@avejr748 @Hassan_Raza @noufalahammed

Thanks

Lets say last working day is strLastWorkingDay,
Create a boolean blnLooking set the default value to True, intCounter set default to -1
Then create a Do while loop based on blnLooking condition
Inside the loop lookup Date.Now.AddDays(intCounter) from your excel. If it is found it means yesterday is a holiday. Assign intCOunter = intCounter -1 which will make your next loop check the previous day, if it is not found, check what day is it.
If Date.Now.AddDays(intCounter).ToString(“dddd”).ToUpperInvariant = “SUNDAY” or Date.Now.AddDays(intCounter).ToString(“dddd”).ToUpperInvariant = “SATURDAY”
Then assign intCOunter = intCounter -1
Else
strLastWorkingDay = Date.Now.AddDays(intCounter).ToString(“dddd”)
blnLooking = False

In your example, this will return Friday

@suraj_gaikwad
Here is a video to find the first, last and total working days using a LINQ query:

You will find everything you need. In case you still have any question, please let me know!

Requirment is like I have to download yesterday date file (T-1)
But yesterday was Holiday so bot should take last working day

Thanks
@avejr748
@Hassan_Raza
@noufalahammed
@Dawodm

My suggested solution would still work for that…

Please elaborate more so I can understand

@avejr748

Thanks

Hi @suraj_gaikwad ,

Find below Flow as per your requirement, hope it helps you

Main - Copy.xaml (17.7 KB)
HolidayList.xlsx (8.2 KB)

Regards,
Vinit Mhatre

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.