|
|||||||||
|
|
![]() |
|
|
|
![]() |
<
![]() |
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Calculating Business DaysIf you look carefully at Seagate Info 7, you'll discovered the IsBusinessDay function is available in the formula editor. But it is no longer available in CR8. We did however, find in the help for DateDiff, a method for calculating the number of business days between two dates. Local DateTimeVar d1 := {Orders.Order Date}; Local DateTimeVar d2 := {Orders.Ship Date}; DateDiff ("d", d1, d2) - DateDiff ("ww", d1, d2, crSaturday) - DateDiff ("ww", d1, d2, crSunday) The local variables are just there to make the rest of the formula easier to read. The first DateDiff function calculates the number of days between our two dates (as in the beginner hint above), while the next two DateDiff functions subtract the Saturdays and Sundays. We’ve been asked in the past if it can also allow for public holidays. The only way we can see to do this is to write a User Function Library. Let us know if you’d like this.
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects. |
|
|