KoolReport's Forum

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

Query not working as expected #1582

Closed The O opened this topic on on Aug 19, 2020 - 1 comments

The O commented on Aug 19, 2020

I am trying to use 2 values in a chart and have the following in my setup

$current_date = "2020-08-18"; //date('Y-m-d');

$this->src('config')->query("select sum(Amount) from history")->pipe($this->dataStore("mydata"));
	   
$this->src('config')->query("select count(distinct(SID)) from other_history where `Date` < '?'",[$current_date])->pipe($this->dataStore("checkedsm"));
	   
$this->src('config')->query(DB::table('sales')->count())->pipe($this->dataStore("totsm"));

mydata and totsm are correctly picked and used in the chart. Checkedsm however is returning a null value (zero.) When I copy and paste the SQL in phpmysql, it gets the value 18 from the database.

I can't figure out what is wrong with the code.

David Winterburn commented on Aug 20, 2020

Please check our answer here:

Query Build Assistance

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

Amazing Theme