Is there any function in lotus script like @businessdays in formula language??
Regards,
Aisha Ishrat.
Is there any function in lotus script like @businessdays in formula language??
Regards,
Aisha Ishrat.
Subject: Lotus Script version of @businessdays
here is a lotusscript version developed by some lotusscript guru:
This is not exact replacement of @businessdays but do check it, i believe it will serve the purpose.
you can also use @businessdays formula directly in lotuscript by using Evaluate statement e.g.
dim result as variant
result = evaluate(|@businessdays(startdate; enddate; daystoexclude;datestoexclude)|)
I didn’t test this if it works…but i believe it should work as well.
Subject: RE: Lotus Script version of @businessdays
let me try.
Subject: Lotus Script version of @businessdays
Try this:
Assuming that ldt and gdt are the starting and ending NotesDateTime(s),
Also assuming that you have a holiday list which you do not want to consider between those dates:
Dim i As Integer, ctr As Integer
Dim dt1 As NotesDateTime
Dim busdays As Variant
dim res as integer
For i =0 To Ubound(holidaylist)
Set dt1 = New NotesDateTime(holidaylist(i))
If gdt.TimeDifference(dt1) < 0 Then Exit For
If dt1.TimeDifference(ldt) >= 0 And gdt.TimeDifference(dt1) >= 0 Then
ctr = ctr+1
End If
Next
busdays = Evaluate({@BusinessDays([ } & Cdat(ldt.DateOnly) & {]; [} & Cdat(gdt.DateOnly) & {]; 1:7)})
res = (Cint(busdays(0)) - ctr)
‘res’ gives you the business days between those dates.
Subject: RE: Lotus Script version of @businessdays
I have done this as follows:
Public Function responsetime( StartDate As String, EndDate As String) As Integer
Dim i As Integer, ctr As Integer
Dim dt1 As NotesDateTime
Dim busdays As Variant
Dim holidaylist (1 To 15) As String
Dim dtEnd As NotesDateTime
Dim dtStart As NotesDateTime
Dim dtTempHoliday As NotesDateTime
Dim lstHolidays List As String
Dim temp As Integer
lstHolidays("02/05/2007") = "Kashmir Day"
lstHolidays("03/23/2007") = "Pakistan Day"
lstHolidays("05/01/2007") = "Labor Day"
lstHolidays("08/14/2007") = "Independence Day"
lstHolidays("11/09/2007") = "Iqbal's Day"
lstHolidays("12/25/2007") = "Quaid's Day"
Set dtStart = New NotesDateTime(StartDate)
Set dtEnd = New NotesDateTime(EndDate )
busdays = Evaluate({@BusinessDays([ } & Cdat(dtStart.DateOnly) & {]; [} & Cdat(dtEnd.DateOnly) & {]; 1:7)})
temp= Cint(busdays(0))
' Count num of holidays
Forall h In lstHolidays
Set dtTempHoliday = New NotesDateTime( Listtag(h) )
If (dtTempHoliday.TimeDifferenceDouble( dtStart ) >= 0) _
And (dtEnd.TimeDifferenceDouble( dtTempHoliday ) >= 0) Then
' Holiday is in this range
temp = temp - 1
End If
End Forall
responsetime = temp
End Function
Many thanks.
Regards,
Aisha Ishrat.