Dear bluecjh,
If the holidays are (or could be) defined in a table within your database then you could easily use a sql expression to get the number of holidays between your two date fields and exlude weekends using standard crystal datediff formula.
If you cannot add a table of dates which is easiest because you can then define in a columns like: Workday, Holiday, and so on for information that you need.
something like (example is MS SQL Syntax):
Code:
(Select Isnull(Sum(H.Holiday),0)
from Holiday H
where H.Date >= convert(varchar(10), ReportTable."FirstDate", 101)
and H.Date < (convert(varchar(10),ReportTable."SecondDate" +1, 101)
)
There are other options, like creating a udf (User Defined Function) that when passed the First Date and Second Date return a list of dates separated by commas. You could then simply call the udf in a sql expression:
(dbo.GetHols(ReportTable."FirstDate",ReportTable."SecondDate"))
Then use that as the array ...
Madawcs solution could also be used, but if the data is stored in another database or in an excel spreadsheet then you could link it using a subreport, set the selection/linking criteria to be your two date fields, and using a shared variable, sum the holidays in the subreport and return back to the main report for use in a calculation....
You have given so little info on what you have that it makes it hard to come up with an optimal solution.
Regards,
ro
Rosemary Lieberman
rosemary-at-microflo.com,
Microflo provides expert consulting on MagicTSD and Crystal Reports.
You will get answers more quickly if you read this before posting: faq149-3762