KoolReport's Forum

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

Pivot Package shows error #220

Open sri opened this topic on on Feb 25, 2018 - 7 comments

sri commented on Feb 25, 2018

Am using pivot package it shows Fatal error in the class my error is:- Fatal error: Class 'koolreport\KoolReport' not found in C:\xampp\htdocs\Piv.php on line 6

Am using Piv.php

use \koolreport\pivot\processes\Pivot;

class Piv extends \koolreport\KoolReport
{
		use \koolreport\clients\Bootstrap;
    function settings()
    {
        return array(
            "dataSources"=>array(
                "marketsp_mktdw"=>array(
                    'connectionString' => 'mysql:host=localhost;dbname=marketsp_mktdw',
                    'username' => 'root',
                    'password' => '',
                    'charset' => 'utf8',
                )
            )
        );
    }
  function setup()
  {
    $node = $this->src('sales')
    ->query("SELECT RESULTS_QTR_CONS__GROSS_SALE, RESULTS_QTR_CONS__OTHER_NETSALES
      FROM qtr_cons_raw WHERE COMPCODE=10245")
    ->pipe(new Pivot(array(
      "dimensions" => array(
        "row" => "RESULTS_QTR_CONS__GROSS_SALE, RESULTS_QTR_CONS__OTHER_NETSALES"
      ),
      "aggregates"=>array(
        "sum" => "RESULTS_QTR_CONS__OTHER_NETSALES",
        "count" => "RESULTS_QTR_CONS__OTHER_NETSALES"
      )
    )))
    ->pipe($this->dataStore('qtr_cons_raw'));  
    }
}

Please let me know.

KoolReport commented on Feb 25, 2018

Hi,

You need to include the autoload.php

require_once "/path/to/koolreport/autoload.php";

Please let us know.

Regards

sri commented on Feb 25, 2018

Still it shows error

Warning: require_once(/path/to/koolreport/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Piv.php on line 2

Fatal error: require_once(): Failed opening required '/path/to/koolreport/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Piv.php on line 2

David Winterburn commented on Feb 26, 2018

Hi there,

The string "/path/to/koolreport" is an example path that you must change to your own path to the folder KoolReport from your page on your computer. Thanks!

sri commented on Feb 26, 2018

Ya i changed, now am getting error in the koolreport page

Fatal error: Uncaught Exception: Datasource not found 'sales' in C:\xampp\htdocs\koolreport\KoolReport.php:189 Stack trace: #0 C:\xampp\htdocs\Piv.php(23): koolreport\KoolReport->src('sales') #1 C:\xampp\htdocs\koolreport\KoolReport.php(31): Piv->setup() #2 C:\xampp\htdocs\ind2.php(3): koolreport\KoolReport->__construct() #3 {main} thrown in C:\xampp\htdocs\koolreport\KoolReport.php on line 189

this is my error. Thanks.

KoolReport commented on Feb 26, 2018

Change it to "marketsp_mktdw". "sales" is only datasource in our example.

sri commented on Mar 1, 2018

Hi, Thank you it works,

Is it possible to display single row value from the db in the same column in kool report one after the another.

eg: Db Table

In this all the 5 values belong to the same S:No

Kool Report Table

The values are displayed in the same column one after the other

Please Let me know

KoolReport commented on Mar 2, 2018

You can use the Transpose process. This will help to turn row to column and vice versa

...
->pipe(new Transpose())
...

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