Hi,
I encounter a problem where i created a Drilldown on my Dashboard. The error occur where i created a filter on my dashboard and i want to pass the parameter chosen by the filter and pass into my second level of DrillDown report. I can only successfully passed the parameter only on the first level and it works just fine, but when enter the second level of DrillDown Report the paramater "$range" does not passed and when i try test to output its return null value. Also how do i assigned the second parameter to my second level mysql query of the report? Is there a solution for my problem?
$range = $this->sibling("AgencyNameLookup")->value();
return [
Level::create()
->title("Agency ".$range)
->widget(
KWidget::create()
->use(\koolreport\widgets\google\ColumnChart::class)
->dataSource(function($params, $scope) use ($range) {
return MyTable::rawSQL(
str_replace(":AgencyName",$range,"
..//my mysql statement
where agency.name = :AgencyName
..//my mysql statement
"//)
)->run();
})->columns([
"Year"=>["type"=>"string"],
"Amount"=>[
"type"=>"number",
"prefix"=>'$
]
])
->settings([
"colorScheme"=>ColorList::random()
])
),
Level::create()
->title(function($parameter){
return "Year ".$parameter["Year"];
})
->widget(
KWidget::create()
->use(\koolreport\widgets\google\ColumnChart::class)
->dataSource(function($params, $scope) {
return JohorPay::rawSQL(
str_replace(":Year",$params["Year"],"
..//my mysql statement
where agency.name = :AgencyName
and year(order.created_date) = :Year
..//my mysql statement
")
)
->run();
})
->columns([
"Month"=>[
"type"=>"string",
"formatValue"=>function($value) {
return date('M', mktime(0, 0, 0, $value, 10));
}
],
"Amount"=>[
"type"=>"number",
"prefix"=>'$'
]
])
->settings([
"colorScheme"=>ColorList::random()
])
)
];
Thanks in advance.
Regards, Afieq