Ibass the date feild would be the same for both the PTA and ATA as we are running a parameter on one feild the date feild. So we have in our record selection of the report:-
{Weekday_Hub_Data.Late Trunk, Inbound/Outbound} in ["IN", "OUT"] and
{Weekday_Hub_Data.Date} in {?Start Date} to {?End Date} and
{Weekday_Hub_Data.Arrivals, Vehicle Route ID} <> "" and
{Weekday_Hub_Data.Late Trunk, Reason Code} <> ""
and the SQL query is :-
SELECT "Weekday_Hub_Data"."Arrivals, Vehicle Route ID", "Weekday_Hub_Data"."Arrivals, Vehicle Type", "Weekday_Hub_Data"."Arrivals, Hub Planned Arrival Time", "Weekday_Hub_Data"."Arrivals, Hub Actual Arrival Time", "Weekday_Hub_Data"."Arrivals, Fill%", "Weekday_Hub_Data"."Date", "Weekday_Hub_Data"."Departures,Actual Departure Time", "Weekday_Hub_Data"."Late Trunk, Inbound/Outbound", "Weekday_Hub_Data"."Late Trunk, (Free Text) Comment?", "Weekday_Hub_Data"."Late Trunk, Reason Code", "Weekday_Hub_Data"."Departures,Planned Departure Time"
FROM "HUB"."dbo"."Weekday Hub Data" "Weekday_Hub_Data"
WHERE ("Weekday_Hub_Data"."Late Trunk, Inbound/Outbound"=N'IN' OR "Weekday_Hub_Data"."Late Trunk, Inbound/Outbound"=N'OUT') AND "Weekday_Hub_Data"."Arrivals, Vehicle Route ID"<>N'' AND "Weekday_Hub_Data"."Late Trunk, Reason Code"<>N'' AND ("Weekday_Hub_Data"."Date">={ts '2009-07-26 00:00:00'} AND "Weekday_Hub_Data"."Date"<{ts '2009-08-22 00:00:01'})
ORDER BY "Weekday_Hub_Data"."Late Trunk, Inbound/Outbound"
so we are using the same date feild to give both our PTA and AAT as the vehicle will only ever arrive on the same date. We have two feilds PTA= Planned arrival time and the AAT = actual arrival time some times the AAT can be earler than the planned but majority of the time the AAT is later than the PTA