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!

calculating working days in a report thats grouped by month

Status
Not open for further replies.
Dec 31, 2004
71
GB
Hi All,
I'm having a few problems returning the correct data in my report. I have used the working hours formula that I found at
My problem is that I need the report to show the whole month and not just the days in which records where created so I created a new DB table to hold dates from 1/1/2010 to 1/1/2020
I then have a table that with the records and the date they were added

I have grouped my report by the DB table that holds all dates and put in the working days formula. Now when I run the report it's fine

If I now try to could records it shows me incorect working days.

My table joins are

DB Dates to recordtable.Date (left outter join)

thanks
 
I can now see where the issue is:-


DateTable recordtable workingdaysformula
31/1/2010 31/1/2010 1
31/1/2010 31/1/2010 1

Is there a way to change the working days formula to work inside a group and only count unique working days?

Thanks


 
Content as per the below

//Main formula
WhileReadingRecords;

Local DateVar Start := date({DATES.DAY}); // place your Starting Date here
Local DateVar End := date({DATES.DAY}); // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;


Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);

Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );

Weeks + Days - Hol
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top