on 07-25-2014 3:25 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.