I've got an error and I'm not sure what's causing it, as it doesn't say where in my php file its occurring. Just that its occurring in the PDoDataSource file. The datasource in config.php is correct with the one in the MyReport.php. Could you tell me what is causing the errors?
Recoverable fatal error: Object of class koolreport\datasources\PdoDataSource could not be converted to string in C:\Apache24\htdocs\koolreport\core\src\datasources\PdoDataSource.php on line 287
This is the error I'm getting
Here is another error which may be related to the first.
Here is MyReport.php code
<?php
//Step 1: Load KoolReport
require_once "../../load.koolreport.php";
//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
//"activeperiod"=>array("2107"),
//"compareperiod"=>array("2106"),
"activeperiod"=>array($this->src("kazzicom_kpi")->query("
select Distinct YearMonth
from tbl_KPIMetrics
Order by YearMonth Desc Limit 0,1")),
"compareperiod"=>array($this->src("kazzicom_kpi")->query("
select Distinct YearMonth
from tbl_KPIMetrics
Order by YearMonth Desc Limit 1,1")),
);
}
protected function bindParamsToInputs()
{
return array(
"activeperiod",
"compareperiod",
);
}
protected function settings()
{
$config = include "../../config.php";
return array(
"dataSources"=>$config
);
}
protected function setup()
{
}
}
Here is my View.Myreport.php
<?php
use \koolreport\widgets\koolphp\Card;
use \koolreport\inputs\Select2;
?>
<div class="report-content">
<div class="text-center">
<h1>KPI Summary</h1>
<p class="lead">
Shows the Sales KPIs for this month.
</p>
</div>
<form method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<b>Active Period</b>
<?php
Select2::create(array(
"multiple"=>false,
"name"=>"activeperiod",
"dataSource"=>$this->src("kazzicom_kpi")->query("
select Distinct YearMonth
from tbl_kpimetrics
Order by YearMonth Desc
"),
"attributes"=>array(
"class"=>"form-control"
)
));
?>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>Compare To Period</b>
<?php
Select2::create(array(
"multiple"=>false,
"name"=>"compareperiod",
"dataSource"=>$this->src("kazzicom_kpi")->query("
select Distinct YearMonth
from tbl_KPIMetrics
Order by YearMonth Desc Limit 1,100
"),
"attributes"=>array(
"class"=>"form-control"
)
));
?>
</div>
<div class="form-group">
<button class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</form>
<div class="row">
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=1")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=1")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"title"=>"Clients Acquired",
"cssClass"=>array(
"card"=>"bg-info",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=2")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=2")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"title"=>"Sales Pipeline",
"cssClass"=>array(
"card"=>"bg-warning",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=3")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=3")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"title"=>"Emails Sent",
"format"=>array(
"value"=>array(
"prefix"=>""
)
),
"cssClass"=>array(
"card"=>"bg-success",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=4")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=4")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"title"=>"Client Calls",
"format"=>array(
"value"=>array(
"prefix"=>""
)
),
"cssClass"=>array(
"card"=>"bg-dark",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
</div>
<div class="text-center" style="margin-top:30px;">
<h3>Brand Summary</h3>
<p class="lead">
Shows the Brand KPIs for this month.
</p>
</div>
<div class="row">
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=5")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=5")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"prefix"=>""
)
),
"title"=>"Website Visitors",
"cssClass"=>array(
"card"=>"bg-info",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=6")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=6")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Impressions",
"cssClass"=>array(
"card"=>"bg-warning",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=7")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=7")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Engagements",
"cssClass"=>array(
"card"=>"bg-success",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=8")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=8")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Followers",
"cssClass"=>array(
"card"=>"bg-dark",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
</div>
<div class="text-center" style="margin-top:30px;">
<h3>Support Summary</h3>
<p class="lead">
Shows the Support KPIs for this month.
</p>
</div>
<div class="row">
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=9")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=9")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"prefix"=>""
)
),
"title"=>"Incoming Tickets",
"cssClass"=>array(
"card"=>"bg-info",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=10")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=10")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Resolved Tickets",
"cssClass"=>array(
"card"=>"bg-warning",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=11")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=11")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Reopened Tickets",
"cssClass"=>array(
"card"=>"bg-success",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=12")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=12")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Avg Resp Time (hrs)",
"cssStyle"=>array(
"negative"=>"color:#3c763d",
"positive"=>"color:#a94442",
),
"cssClass"=>array(
"card"=>"bg-dark",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
</div>
<div class="text-center" style="margin-top:30px;">
<h3>Testing / Quality Assurance Summary</h3>
<p class="lead">
Shows the Testing/QA KPIs for this month.
</p>
</div>
<div class="row">
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=13")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=13")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"prefix"=>""
)
),
"title"=>"New Defects",
"cssClass"=>array(
"card"=>"bg-info",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=14")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=14")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Closed Issues",
"cssClass"=>array(
"card"=>"bg-warning",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=15")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=15")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Open",
"cssClass"=>array(
"card"=>"bg-success",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
<div class="col-md-3">
<?php
Card::create(array(
"value"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :activeperiod and MetricID=16")->params(array(
":activeperiod"=>$this->params["activeperiod"],
)),
"baseValue"=>$this->src("kazzicom_kpi")->query("SELECT MetricValue FROM tbl_KPIMetrics where Client='Kazzicom' and YearMonth= :compareperiod and MetricID=16")->params(array(
":compareperiod"=>$this->params["compareperiod"],
)),
"format"=>array(
"value"=>array(
"suffix"=>""
)
),
"title"=>"Avg Resp Time (days)",
"cssClass"=>array(
"card"=>"bg-dark",
"title"=>"text-white",
"value"=>"text-white"
)
));
?>
</div>
</div>
</div>