I want to convert the Drill Down example to SQL Server. I'm taking baby steps, so I have recreated the payments table in sql server. amount is a money field, and paymentdate is a date field. I did have to change the query a bit, but this is what I have.
"name"=>"saleDrillDown",
"title"=>"Sales Report",
"levels"=>array(
array(
"title"=>"All Years",
"content"=>function($params,$scope)
{
ColumnChart::create(array(
"dataSource"=>(
$this->src("cloudpractice")->query("
SELECT YEAR(paymentDate) as year,sum(amount) as sale_amount
FROM payments
GROUP BY year(paymentdate)
order by year(paymentdate)
")
),
"columns"=>array(
"year"=>array(
"type"=>"string",
"label"=>"Year",
),
"sale_amount"=>array(
"label"=>"Sale Amount",
"prefix"=>"$",
)
),
"clientEvents"=>array(
"itemSelect"=>"function(params){
saleDrillDown.next({year:params.selectedRow[0]});
}",
)
));
}
)
When I execute it I get this error:
Data column(s) for axis #0 cannot be of type string
Can someone tell me what I'm doing wrong?
Thanks Alan