I created a field from a formula I found that excludes weekends and (our) holidays to give me a total work days between "request" date and "completion" date.
The report is grouped by "craft shop", then grouped by "site", then by "work order type".
I have tried to create a formula that would give me a total of work orders "over 7 days old" for "cm" work order type and "over 14 days old" for "pm" work order type.
It used to work when I used this weekend formula:
Local DateTimeVar d1:= {WO.REQUESTDATE};
Local DateTimeVar d2:= CurrentDate;
DateDiff ("d",d1,d2) - DateDiff ("ww", d1, d2, crSaturday) - DateDiff ("ww", d1, d2, crSunday)
When I inserted this formula (which excludes holidays also)
I can't create a formula that will give me a total for each work order type.
WhilePrintingRecords;
DateVar Start := {WO.REQUESTDATE} ;
DateVar End := CurrentDate;
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
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);
if Date(2002,01,01)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,01,18)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,01,21)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,02,18)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,05,27)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,07,04)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,07,05)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,09,02)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,10,14)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,11,28)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,11,29)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,12,24)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,12,25)in start to end then Hol:=Hol+1 else Hol:= Hol;
Weeks + Days - Hol
Does this problem have something to do with nested formulas?
The report is grouped by "craft shop", then grouped by "site", then by "work order type".
I have tried to create a formula that would give me a total of work orders "over 7 days old" for "cm" work order type and "over 14 days old" for "pm" work order type.
It used to work when I used this weekend formula:
Local DateTimeVar d1:= {WO.REQUESTDATE};
Local DateTimeVar d2:= CurrentDate;
DateDiff ("d",d1,d2) - DateDiff ("ww", d1, d2, crSaturday) - DateDiff ("ww", d1, d2, crSunday)
When I inserted this formula (which excludes holidays also)
I can't create a formula that will give me a total for each work order type.
WhilePrintingRecords;
DateVar Start := {WO.REQUESTDATE} ;
DateVar End := CurrentDate;
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
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);
if Date(2002,01,01)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,01,18)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,01,21)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,02,18)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,05,27)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,07,04)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,07,05)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,09,02)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,10,14)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,11,28)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,11,29)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,12,24)in start to end then Hol:=Hol+1 else Hol:= Hol;
if Date(2002,12,25)in start to end then Hol:=Hol+1 else Hol:= Hol;
Weeks + Days - Hol
Does this problem have something to do with nested formulas?