KoolReport's Forum

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

Join is not working the way it should #643

Closed Leon Schubert opened this topic on on Feb 1, 2019 - 3 comments

Leon Schubert commented on Feb 1, 2019

Hey, I try to get something to work where I have to join two different results first and then create a CalculatedColumn based on that.

Strange thing is that it works when I do the join on view-level like this:

$join = $this->dataStore("iv2019")->join($this->dataStore("iv2018"),array("city"=>"city2"));
Table::create(array(
    "dataStore"=>$join,
    ...
));

But when I do it like this in the class where execution of the queries takes place it does not work:

public function setup()
{
    ...
    $join = new Join($this->dataStore("iv2019"), $this->dataStore("iv2018"),array("city"=>"city2"));

    $join->pipe($this->dataStore("result"));
}

Then in view:

    Table::create(array(
        "dataStore"=>$this->dataStore("result"),
        ...
    ));

As far as I understand it should work the second way aswell?

Best regards,

Leon Schubert.

KoolReport commented on Feb 1, 2019

You do this:

->pipe(...)->saveTo($iv2019)
->pipe($this->dataStore("iv2019"));

->pipe(...)->saveTo($iv2018)
->pipe($this->dataStore("iv2018"));

 $join = new Join($iv2019, $iv2018),array("city"=>"city2"));

 $join->pipe($this->dataStore("result"));

In above, we save the Process just before piping to the datastore, and then we use Join to join those processes.

Leon Schubert commented on Feb 4, 2019

Thank you very much, works like a charm now!

KoolReport commented on Feb 4, 2019

Great!!!

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
solved

None