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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Work Days 1

Status
Not open for further replies.

TaylorTot

Technical User
Dec 23, 2003
96
US
I am using Crystal V.8.5. I am pulling from a SQL DB.

My report is setup as follows:

Details 1: event_description event_deadline

I need the report to look like this:

Photos/Scan 5/18/05
3 working days
1st Lasers to Ship Back to SEaver 5/24/05
2 working days

What I can't figure out is how to take the event_deadline and count working days between records? So I need to figure out that there are 2 working days between 5/18/05 and 5/24/05.

Thanks for any help you can provide.
 
Try this formula in the details:

if not(onlastrecord) then
next({event_deadline})-{event_deadline}

-k
 
Sorry, forgot about the workdays:

if not(onlastrecord) then
numbervar Daysbetween:= next({table.event_deadline})-{table.event_deadline};
numbervar workdays:=0;
numbervar counter;
//7 = Saturday
for counter := 1 to Daysbetween do(
if dayofweek({table.event_deadline}) in 2 to 6 then
workdays := workdays +1
);
workdays

-k
 
Thank you this is exactly what I was looking for!!
 
Is it possible to have it count the previous record in other words the report currently looks like this:

Listings Due: 3/31/05
4 days
Ad Sales Due: 4/18/05
15 Days
Begin Production: 4/21/05
5 working days

What I would like it to look like is this:

Listings Due: 3/31/05
15 working days
Ad Sales Due: 4/18/05
5 working days

Thanks for your help.
 
Hi Synapse,

I was wrong this formula is not excluding weekends. It is still counting Saturday and Sunday as a work day. . .
 
Try:

if not(onlastrecord) then
numbervar Daysbetween:= next({table.event_deadline})-{table.event_deadline};
numbervar workdays:=0;
numbervar counter;
//7 = Saturday
for counter := 1 to Daysbetween do(
if dayofweek({table.event_deadline}-1+counter) in 2 to 6 then
workdays := workdays +1
);
workdays

-k
 
Once again perfect, this is what I needed, thank you very much for your help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top