koolreport icon indicating copy to clipboard operation
koolreport copied to clipboard

Data is missing

Open vivianyeoh opened this issue 6 years ago • 1 comments

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

<div style="margin-bottom:50px;">
<?php
ColumnChart::create(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)
    )
));
?>
</div>
<div style="margin-bottom:50px;">
<?php
    
    
    
    
Table::create(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"
    )
));
?>
</div>

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

vivianyeoh avatar Jul 29 '19 05:07 vivianyeoh

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

koolreport avatar Mar 24 '21 19:03 koolreport