Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exclude a Holiday within Datediff

Status
Not open for further replies.
May 25, 2006
5
US
Hello -

I have read many of the previous postings on this subject, but I am new to Crystal and not sure I understand some of the lengthy code examples.

Anyway, I have a report that shows the date difference between a start time and stop time for various tasks. I used the following to exclude weekends:

Local DateTimeVar d1 := {Log_Table.Avail};
Local DateTimeVar d2 := {Log_Table.Keyed};
DateDiff ("d", d1, d2) -
DateDiff ("ww", d1, d2, crSaturday) -
DateDiff ("ww", d1, d2, crSunday)

Now, I need to exclude Holidays as well.
Any suggestions on how to do this would be greatly appreciated.

Thanks
 
Holidays differ around the world, and in specific businesses so the solution will be based on your own set of Holidays.

Here's the standard Crystal based means:


I suggest that people use the big kid method of creating a period table on the database and joining that date to your current table, but this is fairly advanced and since you're new to Crystal, I'd guess that creating a table on the database and using advanced SQL might be out of scope for you.

Anyway, here's that means:

faq767-4532

It uses SQL Server as the database type. I hav some reporting systems that are still in palce frfom years ago based on this approach, and the table is used by coders as well, and it hasn't required updating since because I filled the tables with 10 years of advanced holiday data.

Again, this is a more sophisticated model, but overall it proves simpler, reusable and easier to maintain.

If you have a dba, run the theory by them.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top