KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Access to nested array to create table columns #667

Open Marco Arredondo opened this topic on on Feb 11, 2019 - 5 comments

Marco Arredondo commented on Feb 11, 2019

Hi I'm fairly new using Koolreport and I want to fill a table with data inside an array, the thing is that this array has inside another array with details. I'm not able to access to the details array indexes to create the columns in the table.

Does anyone have a clue how to do this? I paste a the code example.

The clave_producto's column value comes from the details array inside the main array.

Thanks for your attention. Best regards.

KoolReport commented on Feb 12, 2019

Do you use MongoDB or your data is in array format like this?

Marco Arredondo commented on Feb 12, 2019

I'm using Laravel Eloquent to retrieve the data from multiple databases and then I convert the collection into an array.

Andrew Borell commented on Feb 13, 2019

This looks like json input converted to an array. In mysql you can select records to return like this. Just a shot in the dark... does something like this work?

"detalles_transaccion"=>array(
	"label"=>"Producto",
	"formatValue"=>function($value,$row){
		return $row['detalles_transaccion']['clave_producto']; 
	},
),
KoolReport commented on Feb 13, 2019

Thanks Andrew, that's a great way!

Andrew Borell commented on Feb 13, 2019

I think I learned this trick from you a while back, but not for nesting -- that was just a guess applied to the situation.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Laravel