KoolReport's Forum

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

Dashboard: Pivot Table with procedure #2042

Open Andre Van Der Walt opened this topic on on Apr 22, 2021 - 3 comments

Andre Van Der Walt commented on Apr 22, 2021

Hi,

Is there a way to have PivotTable (KWidget) working with procedure? The below code raise an error.

$query = DB::select("
            CALL `get_results`
                (
                1,
                '".$param1."',
                '".$param2."'
                )
        ");
->run()
            ->process(
                ColumnMeta::process([
                    'column1'=>[
                        'type' => 'number',
                    ],
                    'column2'=>[
                        'type' => 'number',
                        'suffix'=> '%'
                    ],
                ])
                    ->pipe(
                    Pivot::process([
                        'dimensions'=>array(
                            'row'=>'column1'
                        ),
                        'aggregates'=>array(
                            'sum'=>'column2',
                        )
                    ])
                )
            );
        return $query;

Thank you

KoolReport commented on Apr 22, 2021

The issue is that the object returned from DB::select() belongs to Laravel, it is not from our data source, thats why run() does not work (simply it does not have the run() method). So please try to use our datasource and use the rawSQL() instead.

AutoMaker::rawSQL("
    your procedure here
")
Andre Van Der Walt commented on May 10, 2021

This do not work

AutoMaker::rawSQL("
    your procedure here
")

Sebastian Morales commented on May 10, 2021

...

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

Dashboard