developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




Calculate Projected Date
Margaret L Malone 02/09/2007 12:05 PM
Applications Development 6.5.4; 6.5.3 FP2; 6.5.3 FP1; 6.5.3; 6.5.2 FP1; 6.5.2; 6.5.1; 6.5; 6.0.5; 6.0.4; 6.0.3; 6.0.2 CF2; 6.0.2 CF1; 6.0.2; 6.0.1 CF3; 6.0.1 CF2; 6.0.1 CF1; 6.0.1; 6.0 Windows 2000; Windows NT


Re: Projected Date: Add X Weekdays to a start date exclude weekends and holidays

I have a start date that I need to add a number of weekdays to calculate a projected target Date (PTD). The number of days to add varies between the different categories of plans, e.g. group is 5 days, non-group is 10 days. Holidays are located in a view maintained by the users of the application. The PTD must exclude the weekends and holidays that fall on or between the start date and PTD. Therefore, I need to calculate and set the new PTD with the actual business date and not the number of days. Let me know if you can assist in modifying this code (formula pls). THANKS!

REM {PTD is Projected TAT Goal Date};
FIELD StrDate := papwrkdate;

REM{assign and adjust date based on plan type 5 or 10 weekdays};
adj:= @If(groupTest = 1 & nongroupTest = 1;@Select(@Weekday(StrDate);8;7;7;7;7;7;9);
groupTest = 1 & nongroupTest = 0; @Select(@Weekday(StrDate);8;7;7;7;7;7;9);
groupTest = 0 & nongroupTest = 1;@Select(@Weekday(StrDate);16;15;15;15;15;15;17);"");
duedate:=@Adjust(StrDate;0;0;adj;0;0;0);

REM{List all Holidays, calculate the number of business days excluding weekends and holidays then adjust};

HolList:=@Date(@TextToTime(@Explode(Holidays)));
days := @BusinessDays ( StrDate ; duedate ; 1 : 7 ;HolList) ;
@If (
days = 1; @Adjust ( duedate ; 0;0;5;0;0;0 ) ;
days = 2; @Adjust ( duedate ; 0;0;4;0;0;0 ) ;
days = 3; @Adjust ( duedate ; 0;0;3;0;0;0 ) ;
days = 4; @Adjust ( duedate ; 0;0;2;0;0;0 ) ;
days = 5; @Adjust ( duedate ; 0;0;1;0;0;0 ) ;
duedate)

Go back