KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Sorting problem #2761

Closed Eugene opened this topic on on Jul 25, 2022 - 4 comments

Eugene commented on Jul 25, 2022

Hi, I again met with the issue with the sorting by the column that consists some dates

Here is my code

$this->src('DB')
            ->query($query4)
            ->params($q_params)
            ->pipe(new Cube(array(
                'row' => 'date',
                'column' => 'server',
                'sum' => 'averageInvoicePerGuest'
            )))
            ->pipe(new DateTimeFormat(array(
                'date' => array(
                    'from' => 'Y-m-d H:i:s',
                    'to' => 'd/m/Y',
                )
            )))
            ->pipe(new ColumnMeta(array(
                '{{all}}' => array(
                    'label' => 'Total',
                ),
            )))
            ->pipe(new Sort(array(
                'date' => 'asc'
            )))
            ->pipe($this->dataStore('myDStore'));

I tried to change the processes order but without any result I always get something like this

Eugene commented on Jul 25, 2022

..

KoolReport commented on Jul 25, 2022

It is better that you sort date before formatting it.

Eugene commented on Jul 25, 2022

Thanks it works

KoolReport commented on Jul 25, 2022

That's great!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Cube