Yeah, I've written stuff like this several times. I'd suggest that
you:
a) Link the report to a stored procedure. You have much more control
with a sproc than a view or direct query against a table.
b) In the sproc, declare a temp table to house the output, and
basically do the same select you are doing now to get the data into
that temp table
c) Create a While loop to examine each record. Within the while loop,
you can use date commands (e.g. DatePart(weekday) to identify the day
of the week of the createdon date, and the responsedate. If it crosses
a weekend boundary, subtract those hours accordingly. (What gets a
little trickier is if the response time takes weeks, and therefore
crosses multiple weekends, which is why this is best done in a sproc.
Alternatively, you can also create a table that contains company
holidays and use the datepart(dayofyear) to search against this table
to determine if it is a weekend or holiday.) Adjust the response
hours in the temp table according to the weekday.
d) Select * from your temp table to produce the result set from the
sproc. Link this to your report, and it should give you what you need.
HTH, if you'd like to discuss offline, please send email to dave at
vscrm.com
Dave
-------------------------------------------------
David L. Carr, President
Visionary Software Consulting, Inc.
http://www.vscrm.com
971-327-6944
**New** See a 23-minute recorded webinar detailing all VAST CRM
auditing features. http://www.vscrm.com/webinar.htm