KoolReport's Forum

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

MultiView drill down #3034

Open jackson opened this topic on on Apr 15, 2023 - 3 comments

jackson commented on Apr 15, 2023

i got error on MultiView drill down (Warning: array_merge(): Expected parameter 1 to be an array, null given in D:\XAMPP\htdocs\koolreport\src\widgets\google\Chart.php on line 157),(Unspecified chart type.) in linechart

Sebastian Morales commented on Apr 17, 2023

Would you pls post your php code of report setup and view and screenshots of the error for us to check it for you?

jackson commented on Apr 19, 2023

set up page

function setup()

{
       $this->src("mydata")->query("SELECT b.SubcategoryName as subcatname,SUM(a.quantity) as quantity,SUM(a.totalamount+a.TaxAmount) as amt FROM `salesitems` as a LEFT JOIN product_subcategory as b ON b.SubCategoryId = a.ProductsubCategoryId AND a.Appcode= b.AppCode WHERE a.AppCode= '$appCode' $saledate GROUP BY a.ProductsubCategoryId ORDER BY quantity desc")->pipe($this->dataStore("data"));
        
}

view page

<?php

use \koolreport\drilldown\MultiView;
use \koolreport\processes\CopyColumn;
use \koolreport\processes\DateTimeFormat;
use \koolreport\widgets\google\LineChart;
use \koolreport\widgets\google\ColumnChart;
use \koolreport\widgets\koolphp\Table;

$outletArray = $this->dataStore('data'); // all products ?> <div class="row">

<div class="col-md-12">
    <div class="tab-content px-1 pt-1">
        <div role="tabpanel" class="tab-pane fade active in" id="available" aria-labelledby="StocksTab" aria-expanded="true">
            <div class="table-responsive">
            <?php
                MultiView::create(array(
                    "name"=>"saleMultiView",
                    "dataSource"=>$this->dataStore('data'),
                    "title"=>"Sale By Month",
                    "views"=>array(
                        array(
                            "handler"=>"<i class='fa fa-line-chart'></i>",
                            "widget"=>array(LineChart::class,array(
                                "columns"=>array(
                                   
                                    "subcatname"=>array(
                                        "label"=>"Subcategory Name"
                                    ),
                                    "quantity"=>array(
                                        "label"=>"Order quantity"
                                    )
                                ),
                            ))
                        ),
                        array(
                            "handler"=>"<i class='fa fa-bar-chart'></i>",
                            "widget"=>array(ColumnChart::class,array(
                                "columns"=>array(
                                    "subcatname"=>array(
                                        "label"=>"Subcategory Name"
                                    ),
                                    "quantity"=>array(
                                        "label"=>"Order quantity"
                                    )
                                ),
                            ))
                        ),
                        array(
                            "handler"=>"<i class='fa fa-table'></i>",
                            "widget"=>array(Table::class,array(
                                "columns"=>array(
                                    
                                    "subcatname"=>array(
                                        "label"=>"Subcategory Name"
                                    ),
                                    "quantity"=>array(
                                        "label"=>"Order quantity"
                                    ),
                                    "amt"=>array(
                                        "label"=>"Total Amount"
                                    )
                                ),
                                "cssClass"=>array(
                                    "table"=>"table table-striped table-bordered"
                                ),
                                "options"=>array(
                        "paging"=>true,
                        "searching"=>true,
                        "order"=>array(
                            array(2,"desc")
                        ),
                        "responsive" => array(
                            "details" => "function() { 
                                $.fn.dataTable.Responsive.display.modal( {
                                    header: function ( row ) {
                                        var data = row.data();
                                        return 'Details for '+data[0]+' '+data[1];
                                    }
                                } ) 
                            }()",
                            "renderer" => "function() { 
                                $.fn.dataTable.Responsive.renderer.tableAll( {
                                    tableClass: 'table'
                                } )
                            }()",
                        )

                    ),
                            ))
                        ),
                    )
                ));
        ?> 
            
            </div>
        </div>
    </div>
</div>

</div>

Sebastian Morales commented on Apr 21, 2023

Pls update to the latest KoolReport version to see if this problem is solved. Rgds,

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

DrillDown