BRGVersion:6 revision:$Revision$ UUID:b375d24e-886d-4718-a880-e6a347271250 timestamp:1609782559 baselib:core baselib:inFlow baselib:lal1 begin:graphprops propdef:MonthName|string|1||None propdef:Holidays|text|1||None prop:MonthName=January prop:Holidays=< null then { sdy = sd.year() sdm = sd.month() # calculcate first day of month first_day = (str(sdy) + str(sdm).pad(2) + "01").date("CCYYMMDD") # calculate last day of month next_month = first_day.dateAdjust(32,"days") next_month_day_one = (str(next_month.year()) + str(next_month.month()).pad(2) + "01").date("CCYYMMDD") last_day = next_month_day_one.dateAdjust(-1,"days") current_day = first_day while current_day <= last_day { # Saturday is 6 and Sunday is 0 in weekday() if current_day.weekday() == 0 or current_day.weekday() == 6 then { nowork_count = nowork_count + 1 } else { workday_count = workday_count + 1 } # move onto the next day current_day = current_day.dateAdjust(1,"days") } # calculcate work days and take holidays into account while i < holidays.len() { hldy = holidays[i].date("CCYY-MM-DD") hlyr = hldy.year() hlmn = hldy.month() # if the year and month are the same, then remove a work day and add a holiday if hlyr == sdy and hlmn == sdm then { workday_count = workday_count - 1 nowork_count = nowork_count + 1 } i = i + 1 # move onto next holiday } } emit mon_name as MonthName, first_day as FirstDayOfMonth, last_day as LastDayOfMonth, workday_count as WorkDayCount, nowork_count as NonWorkDayCount EOX editor:XY=310,130 end:Calcluate_Work_days_in_a_Month_from_Parameter node:For_Input_Pin bretype:core::Static Data editor:Label=For Input Pin editor:handle=5ff352ac102314ef editor:sortkey=5ff352ac102314ef output:@40fe6c55598828e5/= prop:StaticData=<