KoolReport's Forum

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

Result is always just on dataset #1421

Closed Leif opened this topic on on May 4, 2020 - 3 comments

Leif commented on May 4, 2020

I have oriented myself very much by the mysql example. I don't understand why I always get only one record as result, but the table contains more than one record. The example is so simple, what could be wrong? Thank you! :)

Report.php

class Report extends \koolreport\KoolReport
{
    protected function settings()
    {
        return array(
            "dataSources"=>array(
                "tt"=>array(
                    "connectionString"=>"mysql:host=localhost;dbname=tt",
                    "username"=>"root",
                    "password"=>"",
                    "charset"=>"utf8"
                ),
                            
            )
        );
    }
    
    protected function setup()
    {
    
    $this->src('tt')
        ->query("SELECT * FROM session")
        
        ->pipe(new Group(array(
            "client_id"=>"Client-ID",
            "therapist_id"=>"Therapist-ID"
        )))
        ->pipe($this->dataStore('tt'));
 }   
}

Report.view.php

<?php
    Table::create(array(
        "dataStore"=>$this->dataStore('tt'),
        "columns"=>array(
            "therapist_id"=>array(
            	 "type"=>"number",
                "label"=>"Therapist ID",
            ),
            "client_id"=>array(
            	"type"=>"number",
                "label"=>"Client-ID",
                
                        )
        ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered"
        )
    ));
    ?>
KoolReport commented on May 4, 2020

You remove this part:

        ->pipe(new Group(array(
            "client_id"=>"Client-ID",
            "therapist_id"=>"Therapist-ID"
        )))

It is not correct Group process and I think you mistakenly put there.

Leif commented on May 4, 2020

Thank you, that solved my problem. :)

KoolReport commented on May 4, 2020

You are welcome :)

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
solved

None