KoolReport's Forum

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

Error Using #366

Open epba opened this topic on on Jul 11, 2018 - 4 comments

epba commented on Jul 11, 2018

Hai , i am want to filter data from array

showing error " Fatal error: MyReport cannot use koolreport\processes\Filter "

please help me ?

<?php
//MyReport.php
require APPPATH."/libraries/koolreport/autoload.php";

class MyReport extends \koolreport\KoolReport
{
    use \koolreport\clients\Bootstrap; 
    use \koolreport\processes\Filter;
    public function settings()
    {
        return array(
            "dataSources"=>array(
                "myarray_source"=>array(
                    "class"=>'\koolreport\datasources\ArrayDataSource',
                    "dataFormat"=>"associate",
                    "data"=>$this->params["myarray"]
                ),
            )
        );
    }

    function setup()
    {
        $this->src("myarray_source")
        ->pipe(
            $this->dataStore("data")
        )
        ->pipe(new Filter(array(
            array("country","=","France")
        )));
    }
}
KoolReport commented on Jul 11, 2018

Please add:

<?php
//MyReport.php
require APPPATH."/libraries/koolreport/autoload.php";

use \koolreport\processes\Filter;

class MyReport extends \koolreport\KoolReport
{
    ...

The use Filter class should be outside.

epba commented on Jul 11, 2018

error gone, but data not filtered

KoolReport commented on Jul 11, 2018

You should pipe to Filter before pipe to dataStore. dataStore is the final destination.

epba commented on Jul 11, 2018

nice, thank full its very help

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

CodeIgniter