OK this is till an issue, some how it is working at times, so I am doing something wrong here,
I have a ReceivedDate field and from that date I need to add NumDays then I need to set the DueDate field, I need to skip the weenends and the Stat Holidays
So if I have 2 feb, 2009 and I add 5 days I should get 9 feb,2009. Instead I get 8 Feb, 2009 (a Sunday) it should skip the weekends.
On the other hand if I add 4 to 2 feb, 2009 I get 5 feb,2009 (of course I starts to count 4 from the ReceivedDate )
Again if I add 6 days to the ReceivedDate being 2 feb, 2009 then I get 9 feb, 2009, that again it is good…
The StatHolidays are 2008-09-01, 2008-10-13, 2008-11-11, 2008-12-25, 2008-12-26, 2009-01-01
If I test the StatHolidays;
I add 5 days to the 10 Nov, 2008 and I get the 17 Nov, 2008 (it is working as it is not counting the weekend and the statHoliday on the 11 Nov 2008).
I add 4 days to the 10 Nov, 2008 and I get the 16 Nov, 2008 (it is NOT working the 16 is a weekend.).
FIELD NumDays := NumDays;
FIELD ReceivedDate := ReceivedDate;
FIELD DueDate := DueDate;
Received := ReceivedDate;
@For( x := 1;
@BusinessDays( Received ; @Adjust(Received;0;0;x;0;0;0) ; 1:7; @TextToTime(StatHolidays)) <= NumDays;
x := x +1; num := x);
DueDate := @Adjust(Received;0;0;num;0;0;0);
@If( DueDate =“”; @SetField(“DueDate”;DueDate);“”)
Thanks,
Alena