KoolReport's Forum

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

Copy of Datasource Example Report with Errors. #2035

Closed Carlos Eduardo Luminatti opened this topic on on Apr 18, 2021 - 2 comments

Carlos Eduardo Luminatti commented on Apr 18, 2021

Hello all. I'm starting to use Kool Report effectively because I'm replacing Kool PHP with Kppl Reports in the Analytics part ...

In fact, I am trying but to no avail.

I made a connection to my local MariaDB and everything seems to be right, however it does not render the view correctly.

I used as my first example, the datasource type report.

Can you help me ?

<?php

require_once "../../../load.koolreport.php";

use \koolreport\KoolReport;
use \koolreport\processes\Filter;
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Limit;

class intelliti_iqa extends KoolReport
{
    public function settings()
    {
        //Get default connection from config.php
        $config = include "../../../config.php";

        return array(
            "dataSources"=>array(
                "intelliti_iqa"=>$config["iqa"]
            )
        );
    }   
    protected function setup()
    {
        $this->src('intelliti_iqa')
        ->query("SELECT data_venda, vendas FROM v_vendas_ly_calc_date")
        ->pipe(new TimeBucket(array(
            "data_venda"=>"month"
        )))
        ->pipe(new Group(array(
            "by"=>"data_venda",
            "sum"=>"vendas"
        )))
        ->pipe($this->dataStore('vendas_mensais'));
    } 
}

See the View Bellow

<?php 
    use \koolreport\widgets\koolphp\Table;
    use \koolreport\widgets\google\ColumnChart;
?>


    <div 
        <h1>Meu Teste Maria DB</h1>
        <p Este Report está rodando em meu MariaDB Local (local)</p>
    

    <?php
    ColumnChart::create(array(
        "dataStore"=>$this->dataStore('vendas_mensais'),
        "columns"=>array(
            "data_venda"=>array(
                "label"=>"Periodo",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "vendas"=>array(
                "label"=>"Vendas",
                "type"=>"number",
                "prefix"=>"R$",
                        )
        ),
        "width"=>"100%",
    ));
    ?>

    <?php
    Table::create(array(
        "dataStore"=>$this->dataStore('vendas_mensais'),
        "columns"=>array(
            "data_venda"=>array(
                "label"=>"Periodo",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "vendas"=>array(
                "label"=>"Vendas",
                "type"=>"number",
                "prefix"=>"R$",
                        )
        ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered"
        )
    ));
    ?>
</div>

And now, the terrible result ...

Thank You

KoolReport commented on Apr 18, 2021

Please make sure the name of report file is intelliti_iqa.php and the view name is intelliti_iqa.view.php. This is actually the report debug view, showing when report could not find the view file.

Carlos Eduardo Luminatti commented on Apr 18, 2021

WOW ! Thank you !

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
solved

None