koolphp / koolreport

This is an Open Source PHP Reporting Framework which you can use to write perfect data reports or to construct awesome dashboards using PHP
https://www.koolreport.com/
MIT License
226 stars 66 forks source link

Data is missing #34

Open vivianyeoh opened 4 years ago

vivianyeoh commented 4 years ago

I trying to load data from sql and print on the website with koolreport. I have 5 output with this sql on phpmyadmin: SELECT NUMOFNG, NUMOFATTEMPT, AVGTACTTIME, MODULE, RESULT FROM TTLTVNG WHERE RESULT='NG' AND MODULE='24' UNION ALL SELECT 'OK 1',SUM(NUMOFATTEMPT), AVG(AVGTACTTIME), MODULE, RESULT FROM TTLTVNG WHERE RESULT='OK' AND MODULE='24'

but the graph only print 3 of it every time.

Number of NG Total TV Average TIME(s)
1 1 30.10
3 3 6.93
OK 1 357 9.05

my code: protected function setup() { $this->src('sakila_rental') ->query("SELECT NUMOFNG, NUMOFATTEMPT, AVGTACTTIME, MODULE, RESULT FROM TTLTVNG WHERE RESULT='NG' AND MODULE='24' UNION ALL SELECT 'OK 1',SUM(NUMOFATTEMPT), AVG(AVGTACTTIME), MODULE, RESULT FROM TTLTVNG WHERE RESULT='OK' AND MODULE='24'")

    ->pipe(new Group(array(
        "by"=>"NUMOFNG"
    )))
    ->pipe(new Group(array(
        "by"=>"NUMOFATTEMPT"
    )))
    ->pipe(new Group(array(
        "by"=>"AVGTACTTIME"
    )))
    ->pipe($this->dataStore('sale_by_month'));

     print_r(array(
    "dataSource"=>$this->dataStore('sale_by_month'),
    "columns"=>array(
        "NUMOFNG"=>array("label"=>"Number of NG", "type"=>"string"),
        "NUMOFATTEMPT"=>array("label"=>"Total TV"),
        "AVGTACTTIME"=>array("label"=>"Average TIME(s)","type"=>"number","decimals"=>2)
    ),
    "cssClass"=>array(
        "table"=>"table table-hover table-bordered"
    )
));

view.php

$this->dataStore('sale_by_month'), "columns"=>array( "NUMOFNG"=>array("label"=>"Number of NG", "type"=>"string"), "NUMOFATTEMPT"=>array("label"=>"Total TV"), "AVGTACTTIME"=>array("label"=>"Average TIME(s)","type"=>"number","decimals"=>2) ) )); ?>
$this->dataStore('sale_by_month'), "columns"=>array( "NUMOFNG"=>array("label"=>"Number of NG", "type"=>"string"), "NUMOFATTEMPT"=>array("label"=>"Total TV"), "AVGTACTTIME"=>array("label"=>"Average TIME(s)","type"=>"number","decimals"=>2) ), "cssClass"=>array( "table"=>"table table-hover table-bordered" ) )); ?>

How did this happen? What can I do to solve it?

koolreport commented 3 years ago

I see that you used the Group process and your data could be grouped into 3 rows.