KoolReport's Forum

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

What is the best way to get the array of values #2198

Closed Eugene opened this topic on on Jul 11, 2021 - 2 comments

Eugene commented on Jul 11, 2021

Hi, I admit that this question has already been asked, but I could not find an answer on the forum.

I have a datastore. The print_r output looks like this:

koolreport\core\DataStore Object ( [rows:protected] => Array ( [0] => Array ( [stock_date] => 2019-07-31 ) [1] => Array ( [stock_date] => 2019-06-30 ) [2] => Array ( [stock_date] => 2019-05-31 ) [3] => Array ( [stock_date] => 2019-09-30 ) [4] => Array ( [stock_date] => 2019-10-31 ) [5] => Array ( [stock_date] => 2019-11-30 ) [6] => Array ( [stock_date] => 2019-12-30 ) [7] => Array ( [stock_date] => 2020-01-15 )...

What is the best way to get an array of strings like this using the koolreport's features:

["2019-07-31", "2019-06-30", "2019-05-31".... ]

Regards

PS Sure I know it is a couple of lines in PHP but maybe there is a special koolreport's method for that. It could be useful.

KoolReport commented on Jul 11, 2021

Hi Eugene,

You use the pluck() method

$array_of_stockdates = $store->pluck("stock_date");

Hope that helps.

Eugene commented on Jul 12, 2021

Oh yeah I forgot about it. Thanks

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

None