If you’re looking normal calendar… then I guess so Saturday and Sunday are the non working days.
Then to find the current day you can use this simple method Now.ToString("dddd") - It returns the current day, then you can evaluate if the output is not Sat & Sunday then you’re good to go!
I’ve attached a small sequence to find out if Today is holiday.
Details of the Sequence:
Holiday is an array of Strings which holds the week days that are holidays eg:Sunday,Saturday
CheckDay is a Str var to hold today’s week of the day
hope this is helpful
you can manipulate the holidays based on the strings in the array Holiday
@NIVED_NAMBIAR Thank you for your reply!
By the way, it has to identify KR public holiday… which is non-business day.
Can it be possible?
It doesn’t have to verify Sun or Sat. Sorry for lack of information
There is of course a lot of cultural bias here, defining what a working day is.
Mostly it is mon - fri, with exception of several national holidays.
So you need to do 2 checks:
is the day monday-friday (or not saturday-sunday, whichever is easiest). Achivable by the examples above on getting the workday as part of the date: MyDate.DayOfWeek retuns the specific weekday having MyDate as a date or datetime datatype.
is the specific date a non-working holiday. You might be able to scrape this from some website, but that leaves your process with an external dependency on that site. I’d avoid that myself. I would probably set some asset or a small text- or excelfile with a list of holidays to validate against.
So is my date a basic workday and not in my exceptionlist → then it is a workingday.
@NIVED_NAMBIAR@AdityaVN Hello, I found that local custom activity which is getting data from Korea National Official data website API.
But it’s output data type is Dictionary so it cause below error. Is there any way that I can resolve this issue?
You can define your own Calendar on the UiPath Orchestrator, get it from your robot and compare if the date you are evaluating is one of the ExcludedDates by using the Orchestrator API.
Pros: You can set the dates your company/organization defines as non working days and update them directly on the Orchestrator.
Cons: You have to set manually all the non working days. The good part it is you can import a calendar as csv to create the UiPath calendar.
Dictionary can be manipulated to your requirement. But my suggestion is to avoid API calls unless it is absolutely necessary as this will add time to the process.
Instead you can have all the holidays in excel like below (Indian Holiday list), read it as a DataTable,
iterate through each row
add only the dates to a collection variable - you can use Add to Collection activity
check IF collection_var.Contatins(checkDay)
I’ve attached a sequence which check for working or holiday based on the dates in the excel present along with it. It can be invoked in your workflow by converting ‘CheckDay’ as input argument and ‘Result’ as output argument.
Hello, I’ve just created based on your comment since I couldn’t open the file.
By the way, It seems like almost correct but when I test it the result is wrong. Could you please review where is wrong…?
This test file contains today date so, it should show " Holiday" but shows “No Holiday” comment
Hi
yes you identified the reason correctly, Add to Collection will take two input arguments - one is the collections variable (List_Date) and other is holiday date.
Create a datetime var (tempdate)
assign tempdate = Convert.ToDateTime(row(0).ToString)
in Add to Collection properties assign tempdate to Item