Hi
I'm trying to use table grouping to group a database of room bookings by date. The data source has date in format Y-m-d and sorts the records by date. I am formatting the date to D d M Y (e.g. Fri 27 Nov 2020). The table grouping is resorting the data alphabetically (i.e. by day of week) not chronologically.
Any help to resolve is appreciated.
The data selection in the setup()
method in BookingsReport.php
is
`
$this->src("mysql")
->query(
"SELECT booking_dt,
start_tm,
end_tm,
BookingName,
RoomName
FROM bookings
ORDER BY booking_dt,
start_tm"
)
->pipe(new DateTimeFormat([
"booking_dt" => "D d M Y",
"start_tm" => "H:i",
"end_tm" => "H:i",
]))
->pipe($this->dataStore("bookings"));
The report view is defined as
Table::create([
"dataSource"=>$this->dataStore("bookings"),
"columns"=>[
"start_tm"=>[
"label"=>"Start",
],
"end_tm"=>[
"label"=>"End",
],
"BookingName"=>[
"label"=>"Booking"
],
"RoomName"=>[
"label"=>"Room"
],
],
"grouping"=>[
"booking_dt",
],
]);
Many thanks
Nick