KoolReport's Forum

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

How can i get data from PDOdatasource as array? #2161

Open janet opened this topic on on Jun 25, 2021 - 2 comments

janet commented on Jun 25, 2021

I have finally 2 datasources, CSV and PDO (from MySQL).

I'm able to get CSV data as an array and filter PDO to exclude rows that are present in CSV. But i need another one table, that include all CSV rows, that are not duplicate to PDO ones.

janet commented on Jun 25, 2021

To be more clear: i have PDO resource and i filter it through Custom: - if "id" field in array "ids" i mark it as present in another source

After that i have to load() this array "ids" and remove rows with id's, present in PDO

Sebastian Morales commented on Jun 28, 2021

There's a method called requestDataSending you could call right in a report's setup to get data into a datastore and retrieve it like this:

    function setup()
    {
        $this->src("pdo")
        ->pipe(...)
        ->pipe($this->dataStore("myds"))
        ->requestDataSending(); // this method populates data in datastore right at once
        $data = $this->dataStore("myds")->data(); // get data from the populated datastore
        // use $data for your purpose

Let us know if we understand your question correctly. Rgds,

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