Exporting Fields with NULL value?
Closed this issue · 4 comments
elogicmedia commented
I seem to be having an issue exporting to CSV if one of the columns have a NULL value the whole file comes though blank, once I remove that column from the export it works as needed.
Is this a bug or something I am doing incorrectly?
MY EXPORT FUNCTION CODE:
public function export() {
$cond = array();
if(isset($this->request['named']['dept']))
{
$cond[] = array('Item.department_code' => $this->request['named']['dept']);
}
if(isset($this->request['named']['item']))
{
$cond[] = array('Item.item_number' => $this->request['named']['item']);
}
$items = $this->Item->find('all', array('conditions' => $cond));
$_serialize = 'items';
$_header = array('Submitted By', 'Item', 'Department', 'Current Price', 'Suggested Price', 'Status', 'Date Submitted', 'Item id');
$_extract = array('Feedback.contact_name', 'Item.item_description', 'Item.department_description', 'Item.current_price', 'Item.suggested_price', 'ItemStatus.name', 'Item.created', 'Item.id');
$this->viewClass = 'CsvView.Csv';
$this->set(compact('items', '_serialize', '_header', '_extract'));
$this->response->download('exported_pricing_feedback.csv');
$this->response->send();
}
josegonzalez commented
Please send an sql dump of the item table to csvview@josediazgonzalez.com
elogicmedia commented
Thanks, email has been sent.
hharnett commented
elogicmedia, try removing the line:
$this->response->send();
josegonzalez commented
Closed by #11