Have a somewhat convoluted requirement.
I have a route mapping table (tbl_RouteMapping)
Contains ProgDateFrom and ProgDateTo
Unfortunately these can span month or number of months.
IE
Route RouteType ProgDateFrom ProgDateTo PerDayOutput
F101 R002 04/04/2011 05/05/2011 100
F201 R002 04/04/2011 06/06/2011 100
F301 R002 04/04/2011 31/07/2011 100
F401 R002 15/05/2011 19/06/2011 100
V101 R003 24/06/2011 15/08/2011 60
V102 R003 31/07/2011 30/09/2011 60
I have a Route Table (Tbl_Routes)
Which identifies which asset is included in each route.
A person runs a report between a seperate date range (DateFrom to DateTo)
I need to be able to identify which routes are included in that input date range (easy enough).
Because I have no idea between date range particular asset is expected to be attended I have to look at a rather round about method to be able to calculate expected performance compared to actual output.
The way I see it I need to identify how many working days (per month) expected to be carried out and equation to calculate expected output, then compare to actual input.
My biggest problem atm seems to be getting a list of Months and the date range for each route which is carried out per month. So I can then parse that output against a Working Days query.
Working Days is easy enough... just need to figure how to parse the date ranges between months to calculate and once can do that (Per route per month) should be simple maths to calculate output and performance.
So for example if someone inputs 01/05/2011 to 07/08/2011 I would like it to return a table
Route RouteType DateFrom DateTo
F101 R002 04/04/2011 30/04/2011
F101 R002 01/05/2011 05/05/2011
F201 R002 04/04/2011 30/04/2011
F201 R002 01/05/2011 31/05/2011
F201 R002 01/06/2011 06/06/2011
F301 R002 04/04/2011 30/04/2011
F301 R002 01/05/2011 31/05/2011
F301 R002 01/06/2011 30/06/2011
F301 R002 01/07/2011 31/07/2011
F401 R002 15/05/2011 31/05/2011
F401 R002 01/06/2011 19/06/2011
V101 R003 24/06/2011 30/06/2011
V101 R003 01/07/2011 31/07/2011
V101 R003 01/08/2011 07/08/2011
V102 R003 31/07/2011 31/07/2011
V102 R003 01/08/2011 07/08/2011
At least that seems to be where I think I need to be at but maybe someone else can suggest a different angle.
Anything to get the desired results works for me =)
I have a route mapping table (tbl_RouteMapping)
Contains ProgDateFrom and ProgDateTo
Unfortunately these can span month or number of months.
IE
Route RouteType ProgDateFrom ProgDateTo PerDayOutput
F101 R002 04/04/2011 05/05/2011 100
F201 R002 04/04/2011 06/06/2011 100
F301 R002 04/04/2011 31/07/2011 100
F401 R002 15/05/2011 19/06/2011 100
V101 R003 24/06/2011 15/08/2011 60
V102 R003 31/07/2011 30/09/2011 60
I have a Route Table (Tbl_Routes)
Which identifies which asset is included in each route.
A person runs a report between a seperate date range (DateFrom to DateTo)
I need to be able to identify which routes are included in that input date range (easy enough).
Because I have no idea between date range particular asset is expected to be attended I have to look at a rather round about method to be able to calculate expected performance compared to actual output.
The way I see it I need to identify how many working days (per month) expected to be carried out and equation to calculate expected output, then compare to actual input.
My biggest problem atm seems to be getting a list of Months and the date range for each route which is carried out per month. So I can then parse that output against a Working Days query.
Working Days is easy enough... just need to figure how to parse the date ranges between months to calculate and once can do that (Per route per month) should be simple maths to calculate output and performance.
So for example if someone inputs 01/05/2011 to 07/08/2011 I would like it to return a table
Route RouteType DateFrom DateTo
F101 R002 04/04/2011 30/04/2011
F101 R002 01/05/2011 05/05/2011
F201 R002 04/04/2011 30/04/2011
F201 R002 01/05/2011 31/05/2011
F201 R002 01/06/2011 06/06/2011
F301 R002 04/04/2011 30/04/2011
F301 R002 01/05/2011 31/05/2011
F301 R002 01/06/2011 30/06/2011
F301 R002 01/07/2011 31/07/2011
F401 R002 15/05/2011 31/05/2011
F401 R002 01/06/2011 19/06/2011
V101 R003 24/06/2011 30/06/2011
V101 R003 01/07/2011 31/07/2011
V101 R003 01/08/2011 07/08/2011
V102 R003 31/07/2011 31/07/2011
V102 R003 01/08/2011 07/08/2011
At least that seems to be where I think I need to be at but maybe someone else can suggest a different angle.
Anything to get the desired results works for me =)