I am using Crystal 11.5 with Lotus Notes 7 views as datasources for my report.
I am trying to create a report that returns data starting with the previous business day.
I was working on a function that does that, but I need to consider our corporate holidays. Here is a draft of the function with a list of holiday dates hard-coded in an array. This function will keep stepping back one day at a time until it finds a date that is not a Sunday and is not in the array list. I want that date to be the start of the date range for data that gets included in my report.
Function LastBusinessDate() As Date
Dim BadDay As Boolean
Dim PreviousDate As Date
BadDay = TRUE
PreviousDate = CDate(DateAdd("d", -1, CurrentDate))
DO WHILE BadDay = TRUE
IF DayOfWeek(PreviousDate) = 1 OR PreviousDate IN ARRAY (#11/22/2007#, #11/23/2007#, _
#12/24/2007#, #12/25/2007#, #12/31/2007#, #01/01/2008#) THEN
PreviousDate = CDate(DateAdd("d", -1, PreviousDate))
ELSE
BadDay = FALSE
END IF
LOOP
LastBusinessDate = PreviousDate
END Function
And then I use this expression as a record selection formula:
Date({MyTable.ImplementationDate}) >= LastBusinessDate
It works fine but I would like to replace the array list with some kind of a table lookup. We have a Notes view that lists our corporate holidays, I have that view as the second datasource for this report, but I don't know how to access that in a function or a formula.
I am trying to create a report that returns data starting with the previous business day.
I was working on a function that does that, but I need to consider our corporate holidays. Here is a draft of the function with a list of holiday dates hard-coded in an array. This function will keep stepping back one day at a time until it finds a date that is not a Sunday and is not in the array list. I want that date to be the start of the date range for data that gets included in my report.
Function LastBusinessDate() As Date
Dim BadDay As Boolean
Dim PreviousDate As Date
BadDay = TRUE
PreviousDate = CDate(DateAdd("d", -1, CurrentDate))
DO WHILE BadDay = TRUE
IF DayOfWeek(PreviousDate) = 1 OR PreviousDate IN ARRAY (#11/22/2007#, #11/23/2007#, _
#12/24/2007#, #12/25/2007#, #12/31/2007#, #01/01/2008#) THEN
PreviousDate = CDate(DateAdd("d", -1, PreviousDate))
ELSE
BadDay = FALSE
END IF
LOOP
LastBusinessDate = PreviousDate
END Function
And then I use this expression as a record selection formula:
Date({MyTable.ImplementationDate}) >= LastBusinessDate
It works fine but I would like to replace the array list with some kind of a table lookup. We have a Notes view that lists our corporate holidays, I have that view as the second datasource for this report, but I don't know how to access that in a function or a formula.