Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct syntax for adding multiple statements

Status
Not open for further replies.

Hacim

Technical User
Sep 5, 2002
63
US
This formula excludes weekends and holidays from the count of days a work order is open, from {requestdate} to {completiondate} but!
If the work order 'requestdate' falls on a weekend or holiday, I need to use {completiondate - {requestdate} and count the day the work order was requested.
How do you add multiple statements or criteria to this formula? The statements I tried only looked at the last statement.
Also tried If and Then statement which did not work.

DateVar Start := {WO.REQUESTDATE} ;
DateVar End := {WO.COMPLETIONDATE};
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top