I am trying to get the sum() to work in my report footers, where the column value for each row is displayed on conditions.
`
if(classers.subject LIKE "%Math%",it.total_amount,"") AS Math,
if(classers.subject LIKE "%Science%",it.total_amount,"") AS Science,
if(classers.subject LIKE "%Robot%",it.total_amount,"") AS Robotics
I have extracted the updated code from my previous question where I listed the full code [controller + blade]. [](https://www.koolreport.com/forum/topics/3120)
{!! Table::create([
"dataSource" => $data,
"showFooter" => true,
"cssClass" => [
"table" => "table table-striped table-bordered ",
"tr" => "small-font",
],
]) !!}
Also, I found this thread [](https://www.koolreport.com/forum/topics/1887)
where they are using "columns". I am trying to understand the implementation of this.
- I am assuming "taxyear", "employee_email", etc. are columns from the table. Is this correct?
- In my case I have joined a number of tables together and stored the results into the variable $data. Assuming, I am correct above, how do I reference the different columns eg. table_name.table_column. This doesn't sound correct given the knowledge of the joins would be unknown.
- Can I specify the column number in $data?
Thanks again
Chris
"columns"=>array(
"taxyear",
"employee_email",
"employee_title",
"cost_center_name",
"w2_wages"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"sum",
"footerText"=>"<b>Total Wages:</b> @value"
),
"consultant"=>array(
"formatValue"=>function($value) {
return ($value==1)?"Yes":"No";
}
),
"qualified_dollars"=>array(
"cssStyle"=>"text-align:right",
"prefix"=>"$",
"footer"=>"sum",
"footerText"=>"<b>Total Wages Qualified:</b> @value"
)
),