I'm running into a very strange issue. I'm trying to run a CSV type report via array and the problem I'm having is I'm only getting my column header plus one row of data (there should be 9 rows of data). Interestingly enough, if I exclude my column header row, I get two rows of data so it's like there's a hard stop at two lines written to the CSV.
Here is my report class:
class HistoryReport extends \koolreport\KoolReport {
use \koolreport\excel\CSVExportable;
public function settings()
{
return array(
"dataSources"=>array(
"report_data"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"data"=>$this->params["data"],
"dataFormat"=>"table",
)
)
);
}
function setup()
{
$this->src('report_data')
->pipe(new Group(array(
"RequestDate"=>"Request Date",
"RequestedBy"=>"Requested By",
"Amount"=>"Amount",
"censored"=>"censored",
"censored2"=>"censored2",
"censored3"=>"censored3"
)))
->pipe($this->dataStore('history'));
}
}
And here is the code that runs my report:
$requests = get_requests();
if(is_array($requests)) {
$arr = [];
array_push($arr,['Request Date','Requested By','Amount','censored','censored2','censored3']);
foreach($requests as $request) {
array_push($arr,[ $request['company_req_stamp'], $request['company_req_user'], $request['company_req_amount'], $request['company_censored'], $request['acct_inst'], $request['status_id']]);
}
$report = new HistoryReport(array(
"data"=>$arr
));
$report->run()->exportToCSV()->toBrowser('RequestHistory.csv');
return;
}
Does anyone possibly have any idea why I'm not seeing my header plus all 9 test records? I can verify that $arr (above) does have 9 elements in it after my loop is done.
Thanks in advance!