cancel
Showing results for 
Search instead for 
Did you mean: 

Next business day

Former Member
0 Kudos

Is there a way in Crystal Reports to create the report based on the next business day (not calendar day)?

I need to run a report each night containing the next day's data (appointment date field).  However, it must not include weekends.

Any help would be appreciated!


Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi,

You should be able to use a record selection formula with this code to return records for the next business day:

{Date_Field} = (if dayofweek(DateAdd("d",1,currentdate)) = 7 then DateAdd("d",3,currentdate)

else if dayofweek(DateAdd("d",1,currentdate)) = 1 then DateAdd("d",2,currentdate)

else DateAdd("d",1,currentdate))

P.S: You would be better off creating a SQL Expression (if you're reporting against a table) that returns the next business day and use that in the selection formula to ensure it runs that filter as a where clause.

-Abhilash

former_member226862
Participant
0 Kudos

If all you need to do is to exclude Saturdays and Sundays then proposed solution will do the job. However typically such reports need to account for other types of holidays - like New Years, Thanksgiving, etc. Most common suggestion that I found is that you will need to have an array containing dates of all the holidays pertaining to your company and check against the array to see if you need to skip particular date

Answers (1)

Answers (1)

Former Member
0 Kudos

Thank you!

abhilash_kumar
Active Contributor
0 Kudos

If any of the suggestions mentioned here helped, please do close the thread.

-Abhilash

Former Member
0 Kudos

Yes, this was very helpful.  Thanks.