KoolReport's Forum

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

Is KoolReports 3.x compatible with reports created in 2.x? #641

Open Keith Burke opened this topic on on Jan 31, 2019 - 13 comments

Keith Burke commented on Jan 31, 2019

I just dropped in 3.1 over 2.43 and my reports broke. Just wondering if 3.x is compatible to 2,x? The folder structure looks different too.

Can I get a download link to 2.78 pro? I'm specifically looking for the fix to tables working with the drilldown.

KoolReport commented on Jan 31, 2019

What error do you get when upgrade to 3.0.0, if it is related to DrillDown then you may change the name of DrillDown to LegacyDrillDown as we has reworked on the DrillDown for better. The structure changes very much so we decided to keep the old DrillDown in the name of LegacyDrillDown.

Keith Burke commented on Feb 5, 2019

Sorry, I got busy. So, I have reports that work based on 2.x. If I drop in 3.x, I get the following error on all reports... These are just general reports based on DataTables etc

Fatal error: Uncaught Exception: Error on query >>> Operand should contain 1 column(s) in /data/subdomains/kpistage/html/koolreport/src/datasources/MySQLDataSource.php:298 Stack trace: #0 /data/subdomains/kpistage/html/koolreport/src/KoolReport.php(213): koolreport\datasources\MySQLDataSource->start() #1 /data/subdomains/kpistage/html/reports/joiners_and_leavers/index.php(10): koolreport\KoolReport->run() #2 {main} thrown in /data/subdomains/kpistage/html/koolreport/src/datasources/MySQLDataSource.php on line 298

If I remove 3.x and place in 2.x again, the report works.

Keith Burke commented on Feb 7, 2019

Any update on this?

Keith Burke commented on Feb 14, 2019

So I tried upgrading to the newly released 3.25 from 2.43 and am still seeing issues.So my deployment process is to unzip the release into the webserver and name the folder koolreports_{versionnumber}.

I then rename the existing koolreports to koolreports_2.43 I then rename koolreports_3.25 to koolreports.

Only some of my reports work.

I've just figured out that the reports that done work have the following lines in them [with form filters on the view]

    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;

If I remove the two lines above, the report runs, for the most part, albeit without my filter input form working properly.

KoolReport commented on Feb 14, 2019

Dear Keith, is there any error showing?

Keith Burke commented on Feb 14, 2019

Oh yeah, sorry

Fatal error: Uncaught Exception: Error on query >>> Operand should contain 1 column(s) in /data/subdomains/kpistage/html/koolreport/src/datasources/MySQLDataSource.php:348 Stack trace: #0 /data/subdomains/kpistage/html/koolreport/src/KoolReport.php(300): koolreport\datasources\MySQLDataSource->start() #1 /data/subdomains/kpistage/html/reports/churn_by_gym/index.php(10): koolreport\KoolReport->run() #2 {main} thrown in /data/subdomains/kpistage/html/koolreport/src/datasources/MySQLDataSource.php on line 348
KoolReport commented on Feb 14, 2019

The error is from datasource and the cause is from inputs, thats strange. I will need to consult dev team if they have any idea what might go wrong

Keith Burke commented on Feb 14, 2019

Yup, strange. Datasource hasn't changed between KR versions, literally just the KR engine changed from 2.x to 3.x

KoolReport commented on Feb 15, 2019

Hi Keith,

Would you please post me the code part containing your query and parameter binding.

Keith Burke commented on Apr 16, 2019

Sorry, I got VERY busy. I've just tried it with 3.25.4 and the problem still persists. Exact same error. Code below

<?php
require_once "../../koolreport/autoload.php";

    use \koolreport\processes\Sort;
    use \koolreport\processes\Filter;
    use \koolreport\processes\Group;
    use \koolreport\processes\Limit;
    use \koolreport\processes\AccumulativeColumn;
    use \koolreport\processes\DifferenceColumn;

class Joiners extends koolreport\KoolReport
{

    use \koolreport\clients\Bootstrap;
    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;
    use \koolreport\excel\ExcelExportable;


    protected function defaultParamValues()
    {
        $this->src('query_source')
	->query("Select gym_name from ff_gyms where gym_status in (1);")
	->pipe($this->dataStore('select_all_gym_names_result'))
        ->requestDataSending();
        
        $this->src('query_source')
	->query("Select Distinct Year from kpi_joiners_leavers;")
	->pipe($this->dataStore('select_all_years_result'))
        ->requestDataSending();
        
	$this->src('query_source')
	->query("Select Distinct Product from kpi_joiners_leavers;")
	->pipe($this->dataStore('select_all_products_result'))
        ->requestDataSending();
        
        $gymData = $this->dataStore("select_all_gym_names_result")->data();
        $yearData = $this->dataStore("select_all_years_result")->data();
        $productData = $this->dataStore("select_all_products_result")->data();        
        
        $gymList = array();
        $yearList = array();
        $productList = array();
        
        foreach ($gymData as $item)
            $gymList[] = $item["gym_name"];
        
        foreach ($yearData as $item)
            $yearList[] = $item["Year"];
        
        foreach ($productData as $item)
            $productList[] = $item["Product"];
               
        return array(
            "yearSelect"=>array(),
            "gymSelect"=>array(),
            "productSelect"=>array(),
            "gymSelect"=>$gymList,
            "yearSelect"=>$yearList,
            "productSelect"=>$productList
        );
    }

    protected function bindParamsToInputs()
    {
        return array(
            "yearSelect"=>"yearSelect",
            "gymSelect"=>"gymSelect",
            "productSelect"=>"productSelect",
            "options"
        );
    }

    public function settings()
    {
        $config = include "../../includes/config.php";
        return array(
            "dataSources"=>array(
                "query_source"=>$config["query_source"]
            )
        );       
    }

    public function setup()
    {
        $this->src('query_source')
        ->query("select Year, Members from kpi_joiners_leavers "
                . "where Gym IN (:gyms)"
                . ";")
        ->params(array(
            ":gyms"=>$this->params["gymSelect"]
        ))
        ->pipe(new Group(array("by"=>"Year","sum"=>"Members")))
 	->pipe(new Sort(array("Year"=>"asc")))
        ->pipe(new AccumulativeColumn(array("Running Total"=>"Members")))
        #->pipe(new DifferenceColumn(array("Difference"=>"Total")))
        ->pipe($this->dataStore('query_result'));

  ////////////////////////////////////////////////////      
  
        
        $this->src('query_source')
        ->query("Select Year, Month, MonthNum, Joiners, Leavers, Members Difference from kpi_joiners_leavers "
            .
            "where Gym IN (:gyms) and Year IN (:years) and Product IN (:products) "
            . ";")
        ->params(array(
            ":gyms"=>$this->params["gymSelect"],
            ":years"=>$this->params["yearSelect"],
            ":products"=>$this->params["productSelect"]
            ))
        ->pipe(new Group(array("by"=>"Year,MonthNum","sum"=>"Joiners, Leavers, Difference")))
        ->pipe(new Sort(array("Year"=>"asc","MonthNum"=>"asc")))
        ->pipe(new AccumulativeColumn(array("Running Total"=>"Difference")))
        ->pipe($this->dataStore('joiner_leaver_result'));
        
  ////////////////////////////////////////////////////      
        
        $this->src('query_source')
	->query("Select * from ff_gyms where gym_status in (1);")
	->pipe(new Sort(array("gym_name"=>"asc")))
	->pipe($this->dataStore('gym_names_result'));
        
  ////////////////////////////////////////////////////      
        
	$this->src('query_source')
	->query("Select Distinct Year from kpi_joiners_leavers;")
	->pipe(new Sort(array("Year"=>"asc")))
	->pipe($this->dataStore('years_result'));

  ////////////////////////////////////////////////////      
        
	$this->src('query_source')
	->query("Select Distinct Product from kpi_joiners_leavers;")
	->pipe(new Sort(array("Product"=>"asc")))
	->pipe($this->dataStore('products_result'));

  ////////////////////////////////////////////////////      
    }
}


KoolReport commented on Apr 17, 2019

Hi Keith,

Please help us to go to MySQLDataSource.php line 224 and replace this line:

$value = "(".implode(",", $value).")";

with this

$value = implode(",", $value);

We will enforce the rule of using parenthesis () with IN operator

Keith Burke commented on Apr 18, 2019

Yup, that appears to have resolved it. Good catch. Can that be patched into the next version?

KoolReport commented on Apr 18, 2019

It will be in next version

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
bug
help needed
solved

DrillDown