KoolReport's Forum

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

Process API response in Dashboard #3217

Closed John opened this topic on on Dec 26, 2023 - 3 comments

John commented on Dec 26, 2023

I followed these guidelines: https://www.koolreport.com/forum/topics/2537 with success! I also want to query the response data (e.g. group by, sum etc), so i think i should use processes. Am i correct and how can i do this? I made some trials on this but i was unsuccesfull..

Sebastian Morales commented on Jan 4

Pls try to use KoolReport's ArrayDataSource and pipes like this:

    protected function dataSource()
    {
        $output = getDataFromApi();
        $arrDataSource = new \koolreport\datasources\ArrayDataSource(array(
            "data" => $output,
            "dataFormat" => "associate", // or "table" 
        ));
        return $arrDataSource
            ->pipe(...)
            ->pipe(...)
        ;
    }
John commented on Jan 4

Excellent, thank you!

Note: It shows error > Class "koolreport\datasource\ArrayDataSource" not found

You have to change to new \koolreport\datasources\ArrayDataSource

Sebastian Morales commented on Jan 5

You are correct about the class path, John! Happy to know this solution works for you. Cheers,

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