Hi, I have challenge with getting this query to execute. I followed your examples but not sure if there is any way to see what is coming out. Glad for some assistance in resolving it.
The query
class PaymentList extends KoolReport
{
use \koolreport\inputs\POSTBinding;
use \koolreport\export\Exportable;
protected function defaultParamValues()
{
return array(
"academic_year_id"=>array(), "term_id"=>array(), "payment_call_id"=>array(), "community_id"=>array()
);
}
protected function bindParamsToInputs()
{
return array(
"academic_year_id", "term_id", "payment_call_id", "community_id",
);
}
public function settings()
{
$config = include "../config.php";
return array(
"dataSources"=>array(
"abc"=>$config["postdb"]
),
);
}
protected function setup()
{
$this->src('abc')
->query("SELECT
application_code,
applicant_name,
place as community,
ds1.list_source_value as good_behaviour,
ds2.list_source_value as rc_submitted,
ds3.acada_year,
ds4.list_source_value as pay_call_type,
date_payment_call,
payment_amount,
concat('P',lpad(payment_call_id::text,4,'0')) as payment_code
FROM nak_applicant_payment a
INNER JOIN nak_applicant b on a.applicant_id=b.applicant_id
".
(($this->params["term_id"]!=array())?" AND a.term_id IN (:term_id)":"")
."
INNER JOIN community ds5 on ds5.community_id = b.applied_community_id
".
(($this->params["community_id"]!=array())?" AND ds5.community_id IN (:community_id)":"")
."
INNER JOIN controller.mydatasourcelist ds1 on ds1.mydatasourcelist_id=a.exhibit_good_behaviour_id
INNER JOIN controller.mydatasourcelist ds2 on ds2.mydatasourcelist_id=a.report_card_received_id
INNER JOIN academic_year ds3 on ds3.academic_year_id=a.academic_year_id
".
(($this->params["academic_year_id"]!=array())?" AND a.academic_year_id IN (:academic_year_id)":"").
".
INNER JOIN controller.mydatasourcelist ds4 on ds4.mydatasourcelist_id=a.payment_call_type_id
".
(($this->params["payment_call_id"]!=array())?" AND a.payment_call_id IN (:payment_call_id)":"")
)
->params(array(
":academic_year_id"=>(int)$this->params["academic_year_id"],
":term_id"=>(int)$this->params["term_id"],
":payment_call_id"=>(int)$this->params["payment_call_id"],
":community_id"=>(int)$this->params["community_id"],
))
->pipe($this->dataStore("result"));
$this->src("abc")->query("
SELECT
community_id,place
FROM
community a inner join nak_operation_areas b on a.community_id=b.community_id
ORDER BY place
")
->pipe($this->dataStore("dscommunity"));
$this->src("abc")->query("
SELECT
academic_year_id, acada_year
FROM
academic_year
ORDER BY acada_year
")
->pipe($this->dataStore("dsacada_year"));
$this->src("abc")->query("
SELECT
mydatasourcelist_id,list_source_value
FROM
controller.mydatasourcelist
ORDER BY list_source_value
")
->pipe($this->dataStore("dsterm"));
$this->src("abc")->query("
SELECT
payment_call_id,concat('P',lpad(payment_call_id::text,4,'0')) as pay_code
FROM
payment_call
WHERE academic_year_id in (:academic_year_id )
AND term_id in (:pterm_id)
ORDER BY payment_call_id
")
->params(array(
":academic_year_id"=>$this->params["academic_year_id"],
":term_id"=>$this->params["term_id"]
))
->pipe($this->dataStore("dspsyment_call"));
}
}
.
The error I get on the page are
Notice: Undefined index: term_id in ..\PaymentList.php on line 67
Notice: Undefined index: community_id in ..\PaymentList.php on line 71
Notice: Undefined index: academic_year_id in ..\PaymentList.php on line 77
Notice: Undefined index: payment_call_id in ..\PaymentList.php on line 81
Notice: Undefined index: academic_year_id in ..\PaymentList.php on line 85
Notice: Undefined index: term_id in ..\PaymentList.php on line 86
Notice: Undefined index: payment_call_id in ..\PaymentList.php on line 87
Notice: Undefined index: community_id in ..\PaymentList.php on line 88
Notice: Undefined index: academic_year_id in ..\PaymentList.php on line 132
Notice: Undefined index: term_id in ..\PaymentList.php on line 133
Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :academic_year_id in ..\PdoDataSource.php on line 125
Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :term_id in ..\PdoDataSource.php on line 125
Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :payment_call_id in ..\PdoDataSource.php on line 125
Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :community_id in ..\PdoDataSource.php on line 125
Fatal error: Uncaught exception 'Exception' with message 'Query Error >> [ERROR: missing FROM-clause entry for table "academic_year_id" LINE 19: ...ER JOIN academic_year ds3 on ds3.academic_year_id=a.academic... ^] >> SELECT application_code, applicant_name, place as community, ds1.list_source_value as good_behaviour, ds2.list_source_value as rc_submitted, ds3.acada_year, ds4.list_source_value as pay_call_type, date_payment_call, payment_amount, concat('P',lpad(payment_call_id::text,4,'0')) as payment_code FROM nak_applicant_payment a INNER JOIN nak_applicant b on a.applicant_id=b.applicant_id INNER JOIN community ds5 on ds5.community_id = b.applied_community_id INNER JOIN controller.mydatasourcelist ds1 on ds1.mydatasourcelist_id=a.exhibit_good_behaviour_id INNER JOIN controller.mydatasourcelist ds2 on ds2.mydatasourcelist_id=a.report_card_received_id in C:\xampp\htdocs\koolreport\datasources\PdoDataSource.php on line 202
*