KoolReport's Forum

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

Datasource not found 'dataSource' #1191

Closed Vijit Atreya Paudel opened this topic on on Nov 28, 2019 - 3 comments

Vijit Atreya Paudel commented on Nov 28, 2019

I see a Datasource not found exception. I am trying to use an api's json response:

public function settings()
    {
        $client = new \GuzzleHttp\Client();
        $res = $client->get('http://someApiCall');
        $apiarray = json_decode($res->getBody()->getContents());        
        return array(
            "dataSource"=>array(
                "apiarray"=>array(
                    "class"=>'\koolreport\datasources\ArrayDataSource',
                    "dataFormat"=>"associate",
                )
            )
        );
    }
KoolReport commented on Nov 28, 2019

Hi, the key is "dataSources" not "dataSource". The "s" means that you can define many datasources there.

Vijit Atreya Paudel commented on Nov 28, 2019

That one worked. Thank you. Now I am getting Class 'App\Reports\Sort' not found and Class 'App\Reports\Group' not found

function setup()
    {
        $this->src('apiarray')
        ->pipe(new Group(array(
            "by"=>"some_column"
        )))
        ->pipe(new Sort(array(
            "some_column"=>"desc"
        )))
        ->pipe(new Limit(array(10)))
        ->pipe($this->dataStore('myDataStore'));        
    }
KoolReport commented on Nov 28, 2019

You have to use

use \koolreport\processes\Group;
use \koolreport\processes\Sort;

Better you have a look at our examples, it is fast way to learn.

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
None yet

None