CR 8.5 Developer
Oracle 8i using Oracle ODBC Connectivity
I know it's simple but it's a Friday and I think I lost it.
Using Ken Hamady's formula #17, I made some modifications to accommodate a holiday table, {calendar_exceptions}, to add 15 business days to a Send date
Currently {@SendDate} is first day of the month. I have been able to adjust the date to the 1st business day of the month if it falls on a weekend or holiday as follows.
The problem with this formula is that target + 1, target + 2, dayofweek(target) may fall on a holiday.
How do I make the proper adjustments to come up with the first business day of the month.
Thanks,
-LW
Oracle 8i using Oracle ODBC Connectivity
I know it's simple but it's a Friday and I think I lost it.
Using Ken Hamady's formula #17, I made some modifications to accommodate a holiday table, {calendar_exceptions}, to add 15 business days to a Send date
Code:
//Adding Business Days:
WhileReadingRecords;
DateVar Target := {@SendDate}; // Put your field name in here
NumberVar Add:= 15; // put the number of days here to add (a positive number)
NumberVar Added := 0;
WHILE Added < Add
Do (target := target +1;
if dayofweek (target) in 2 to 6 and not (target = {CALENDAR_EXCEPTIONS.EXCEPTION_DATE})
then Added:=Added+1
else Added:=Added);
Target
Currently {@SendDate} is first day of the month. I have been able to adjust the date to the 1st business day of the month if it falls on a weekend or holiday as follows.
Code:
WhileReadingRecords;
datevar target := dateserial(year(currentdate),month(currentdate)+1,1);
if dayofweek(target) in [2 to 6] and not(target = {CALENDAR_EXCEPTIONS.EXCEPTION_DATE} then
Target
else if dayofweek(target) = 7 then
target + 2
else
target + 1
The problem with this formula is that target + 1, target + 2, dayofweek(target) may fall on a holiday.
How do I make the proper adjustments to come up with the first business day of the month.
Thanks,
-LW