KoolReport's Forum

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

How to store array in a datastore #2175

Open Chris Sideris opened this topic on on Jun 30, 2021 - 6 comments

Chris Sideris commented on Jun 30, 2021

Hi, I have an array of data which is being calculated using a datastore and now I would like to put this array into a new datastore to be used in creating the datatable report. How do I put this array into a new datastore?

cfsinc commented on Jul 1, 2021

Chris,

have you seen this in the documentation example about piping an array into the datastore?

https://www.koolreport.com/examples/reports/datasources/array_report/

Chris Sideris commented on Jul 30, 2021

@cfsinc I have an array which I calculate in the setup() and the link you provided has a static array already in the settings().

Chris Sideris commented on Jul 30, 2021

Koolreport any suggestions?

Sebastian Morales commented on Aug 2, 2021

Chris, just create a new empty DataStore object and use this method to set its data and meta:

https://www.koolreport.com/docs/datastore/overview/#selecting-methods-data

$myDS = new \koolreport\core\DataStore($arrayData, $arrayMeta);

or:

$myDS = new \koolreport\core\DataStore();
$myDS->data($arrayData);
$myDS->meta($arrayMeta);
Javier Gallardo commented on Jan 7, 2022

-

Javier Gallardo commented on Jan 7, 2022

-

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