KoolReport's Forum

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

Simple code but not work #1000

Open Jinn Park opened this topic on on Jul 19, 2019 - 2 comments

Jinn Park commented on Jul 19, 2019

hello i built a simple code for test but it didn't work

can you guys help me?

index.php
<?php
require_once "testReport.php";

$report = new testReport;
$report->run()->render();
?>
testReport.php
<?php

require_once "../koolreport/core/autoload.php";

use \koolreport\KoolReport;
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;

class testReport extends KoolReport
{
    use \koolreport\clients\Bootstrap;

    public function settings()
    {
        return array(
            "dataSources"=>array(
                "testReport"=>array(
                    "class"=>'\koolreport\datasources\CSVDataSource',
                    'filePath'=>dirname(__FILE__)."\data.csv",
                )
            )
        );
    }   
    protected function setup()
    {
        $r = $this->src('testReport')->pipe($this->dataStore('test_csv'));
        print_r($r);
    } 
}
?>
testReport.view.php
<?php 
use \koolreport\widgets\koolphp\Table;
?>

<div class="report-content">
    <div class="text-center">
        <h1>First CSV Report</h1>
        <p class="lead">The report shows how to build report from CSV data</p>
    </div>

    <?php
    Table::create(array(
        "dataStore"=>$this->dataStore('test_csv'),
        "width"=>"100%",
        "height"=>"500px",
        "columns"=>array(
            "사용한도",
            "사원번호",
            "성명",
            "카드명",
            "카드번호"
        ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered"
        )
    ));
    ?>

</div>
this is my data.csv
사용한도,사원번호,성명,카드명,카드번호
"1000000","0068","배땡땡","국민카드","9200-1111-0000-0000"
"1000000","0146","천땡땡","국민카드","7100-2222-0000-0000"
"1000000","0257","최땡땡","국민카드","7100-3333-0000-0000"
"1000000","0273","지땡땡","국민카드","8300-4444-0000-0000"
"1000000","0314","반땡땡","국민카드","4100-5555-0000-0000"
"1000000","0335","여땡땡","국민카드","5100-6666-0000-0000"

it shows me a table but all datas are '0' what is wrong in my code?

KoolReport commented on Jul 19, 2019

If you remove this following code:

        "columns"=>array(
            "사용한도",
            "사원번호",
            "성명",
            "카드명",
            "카드번호"
        ),

does it work?

Jinn Park commented on Jul 22, 2019

yes I saw my colums but there is no data in table

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