I need to set the DueDate field with a number of days.
doc.DateReceived has 13/01/2009
DueDate is the date I need to set from the number of days selected by a field “CalculationDaysToAdd”. I need to also keep in mind the Business days when I need to add for exemple 10 days to the DateReceived.
Dim DueDate As New NotesDateTime(doc.DateReceived(0) )
DaysToAdd = doc.CalculationDaysToAdd
.
Call DueDate.AdjustDay(DaysToAdd(0),True)
doc.DateReceived = DueDate ‘ I know this is wrong but at this time I get 12:00, 1200: as the DueDate
Subject: RE: Need to set a date field with a certain number of days.
Thanks for your comment…
The code is in the PostCalc event, I am setting the ReceivedDate then I add the NoDays then the code post calculates, I noticed in dubug that the ReceivedDate is not really set to the date I have just entered, how can I made the date physically there when I run the PostCalcul event? Right now the DueDate is still being set to nothing.
Dim DueDate As New NotesDateTime(doc.ReceivedDate(0) )
test := @Adjust(Today;0;0;num;0;0;0); ’ test is = to the rithg date.
** if the code stops here then it is ok as the @for funciton gives me the right values being 2008-11-17, it does skip the weekend. The problem is now that I have to skip the Holidays, in the field StatHolidays there are all 10 holidays for the year. But the code I used give me the day on a weekend, so I am going something wrong…
info :=@BusinessDays( fldReceivedDate ; test ; 1:7 ; @TextToTime(StatHolidays) );
@Prompt([Ok];“”;@Text(info)) ’ wrong value here…???
Subject: RE: Need to set a date field with a certain number of days.
Based on your description it sounds like you’re possibly gettting the data from a backend document when you want the value in the front end. Therefore you will need to pull it from the UI.
Therefore does duedate look better in the debugger when you do this:
Dim DueDate As New NotesDateTime( uidoc.FieldGetText(“ReceivedDate”) )
Subject: * New issue–Need to set a date field with a certain number of days.
Too bad StatHolidays is not a multivalue Date/Time - wonder if this will cause trouble.
I also started you loop at Numdays + NoWks * 2, as it seems kinda pointless to start at 1 when you know you need to jump at least the number of days you requested. The NoWks count means we know we can skip at least 2 more days for each weekend.
Today := fldReceivedDate;
NoWks := @Integer( NumDay/5 ); REM { MADE A CORRECTION HERE };
@For( x := NumDays + (NoWks *2);
@BusinessDays(Today; @Adjust(Today;0;0;x;0;0;0); 1:7; @TextToTime(StatHolidays) ) <= NumDays;
x := x +1;
num := x);