I am trying insert a formula designed from another report which calculates age of work orders while excluding holidays, weekends etc. I don't have a clue what this error is referencing.
WhileReadingRecords;
DateVar Array Holidays;
DateVar Start := if {WO.WOTYPE}='PM' THEN Date({WO.SCHEDSTARTDATE}) ELSE Date({WO.REQUESTDATE});
DateVar End := if isnull({WO.COMPLETIONDATE}) then Currentdate else Date({WO.COMPLETIONDATE});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
//Figure the number of Calendar "Rows" involved and count 5 days for each:
Weeks:= (Truncate (End - dayofWeek(End) + 1 -
(Start - dayofWeek(Start) + 1)) /7 ) * 5; //Adjust the first and last weeks based on when in the week you start and end
Days := DayOfWeek(End) - DayOfWeek(Start) + 1
+ (if DayOfWeek(Start) = 1 then -1 else 0) //adjust for starting on a Sunday:
+ (if DayOfWeek(End) = 7 then -1 else 0); //adjust for ending on a Saturday:
//Adjust for Holidays in the period between the start and end dates:
Local NumberVar i;
For i := 1 to Count(Holidays)
Do ( if Holidays in start to end
then Hol:=Hol+1
else Hol:=Hol);
//Assemble the adjusted work days
Weeks + Days - Hol
WhileReadingRecords;
DateVar Array Holidays;
DateVar Start := if {WO.WOTYPE}='PM' THEN Date({WO.SCHEDSTARTDATE}) ELSE Date({WO.REQUESTDATE});
DateVar End := if isnull({WO.COMPLETIONDATE}) then Currentdate else Date({WO.COMPLETIONDATE});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
//Figure the number of Calendar "Rows" involved and count 5 days for each:
Weeks:= (Truncate (End - dayofWeek(End) + 1 -
(Start - dayofWeek(Start) + 1)) /7 ) * 5; //Adjust the first and last weeks based on when in the week you start and end
Days := DayOfWeek(End) - DayOfWeek(Start) + 1
+ (if DayOfWeek(Start) = 1 then -1 else 0) //adjust for starting on a Sunday:
+ (if DayOfWeek(End) = 7 then -1 else 0); //adjust for ending on a Saturday:
//Adjust for Holidays in the period between the start and end dates:
Local NumberVar i;
For i := 1 to Count(Holidays)
Do ( if Holidays in start to end
then Hol:=Hol+1
else Hol:=Hol);
//Assemble the adjusted work days
Weeks + Days - Hol