KoolReport's Forum

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

Use the query for double graph #1426

Closed Michele Bassanini opened this topic on on May 6, 2020 - 2 comments

Michele Bassanini commented on May 6, 2020

If I had a query like this

$this->src("default")
                ->query("SELECT FIELD1, FIELD2
                        FROM MYTABLE")
                ->pipe(new DateTimeFormat([
                    "FIELD1" => [
                        "from" => "d/m/Y H:i:s",
                        "to"   => "Y-m-d",
                    ],
                ]))
                ->pipe(new Sort([
                    "FIELD1" => "asc",
                ]))

and than I what to apply two different Filter process and than a Group process, I had to create 2 different query or I can use the same base?

Something like these

$aboveQueryObject->pipe(new Filter(first filter))->pipe(new Group()) and than store to a datastore
---copy the 
$aboveQueryObject->pipe(new Filter(second filter))->pipe(new Group()) and than store to another datastore
KoolReport commented on May 6, 2020

You use the pipeTree to branch data to different branch.

For example:

$this->src("data")
->pipe(new ColumnMeta(..))
->pipeTree(
    function ($node) {
        $node->pipe(new Filter(...))
        ->pipe($this->dataStore("store1"));
    },
    function ($node) {
        $node->pipe(new Filter(...))
        ->pipe($this->dataStore("store2"));
    }   
);
Michele Bassanini commented on May 6, 2020

Thank you very much!

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
solved

None