Hi All, I have a query that works on mysql and shows the right results, however when I plug in the report the columns client and tourname are blank.
$this->src('mysql')->query("SELECT act.Type, act.Due_date, act.Subject, T.number, T.name as tour, C.name as client, act.Status, act.notes,
concat_WS(' ' ,T.number, ' ',T.name) as tourname
FROM activities as act
left join tours as T on T.id = act.activatable_id AND act.activatable_type='App\\Tour'
left join clients as C on C.id = act.activatable_id AND act.activatable_type='App\\Client'
WHERE
act.Status!='Completed' AND act.staff_id=$staff_id
order by act.Due_date ASC; ")
->pipe($this->dataStore('searchableActivities'));
VIEW:
<?php
DataTables::create(array(
//"dataSource"=>$this->dataStore("searchableActivities"),
"dataStore" => $this->dataStore("searchableActivities"),
"options"=>array(
"searching"=>true,
"fixedHeader"=>true
// "paging"=>true,
),
"columns"=>array(
"Type",
"Due_date",
"Subject",
"tourname"=>array(
"type"=>"text",
"label"=>"Tours",
),
"client",
"Status",
"notes"
)
));
?>
thank you