I currently have a report that calculates the number of work days for employees. The formula references a formula field that contains the holidays. This makes me open the report every year and add more holidays. I would like to put the holidays in a table but I cannot get the formula to read the table.
I have created a subreport that has the holidays (good up to here)
but I don't know how to get that value into the final formula. It will return different values for each month.
This is what I have:
SubReport Details Section
WhilePrintingRecords;
Shared Numbervar ArraySize;
Shared DateTimeVar Array HolidaysTest;
ArraySize := ArraySize + 1;
ReDim Preserve HolidaysTest[ArraySize];
HolidaysTest[ArraySize] := {WSSC_HOLIDAY.HOLIDAY_DATE};
This is inserted into the main report monthly date group header.
I can see all of the holidays but don't know how to get it to count them properly. This is the formula that I'm using for the employee line.
//Main formula
WhileReadingRecords;
//use next 2 lines if you are running for one month. Multiple months returns total number
//of work days in the time frame and not monthly work days.
//Global DateVar Start := Date({?StartDate}); // place your Starting Date here
//Global DateVar End := Date({?EndDate}); // place your Ending Date here
//Use next 2 stmts if you need to reset the workdays each month otherwise the top two works fine.
Global DateVar Start;
Global DateVar End;
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Local Numbervar TotDays;
Local Numbervar MonthNum;
Local Numbervar CntWeds;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
CntWeds := DateDiff ("ww", Start, End, crWednesday);
If DayOfWeek(Start) = crWednesday Then
CntWeds := CntWeds + 1
else
CntWeds ;
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );
//convert to hours
TotDays :=
(Weeks + Days - Hol - CntWeds)
Ideally I just want to switch out the database holiday for the hardcoded holidays. Any help will be greatly appreciated.