Hello team! Please help me : I created a datasource, treePiped it to three sources according a filter. I have now 3 datasources, I can pipe them to 3 datastores (Rentres, Promis, Sortis, the view works with each one separately) but I want Join these 3 datastores into 1 (or perhaps the 3 datasources?) and view it. how to do ? The join I tried does not produce anything. Here is my source : * (is the problem on line 108 ?
what does $join1, ? how to pipe it to a new datastore ?
can i do a $join2 to add the third datasore) *
<?php //Step 1: Load KoolReport require_once "../../../load.koolreport.php";
use \koolreport\processes\Group; use \koolreport\processes\Map; use \koolreport\processes\Sort; use \koolreport\processes\Filter; use \koolreport\processes\CopyColumn; use \koolreport\processes\ColumnRename;
//Step 2: Creating Report class class balance_articles extends \koolreport\KoolReport { use \koolreport\inputs\Bindable; use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
"Sel_Article"=>'%',
"dateRange"=>array(date("2022-01-01"),date("2022-03-31")),
);
}
protected function bindParamsToInputs()
{
return array(
"Sel_Article"=>"Sel_Article",
"dateRange"=>"dateRange",
);
}
/*protected function settings()*/
public function settings()
{
$config = include "../../../config.php";
return array(
"dataSources"=>array(
"phamm"=>$config["phamm"]
)
);
}
public function setup()
{
$this->src('phamm')
->query("
SELECT
items.item AS 'Article',
items.balance AS 'Stock',
SUM(batches.quantity) AS 'Quantite',
batches.etat AS 'Etat'
FROM
batches
INNER JOIN items ON (batches.item = items.id)
WHERE
items.item LIKE :Sel_Article
AND
batches.manufacturing_date BETWEEN :start AND :end
GROUP BY
items.item,
batches.etat
")
->params(array(
":Sel_Article"=>$this->params["Sel_Article"],
":start"=>$this->params["dateRange"][0],
":end"=>$this->params["dateRange"][1],
))
->pipe(new \koolreport\processes\Map(array(
"{meta}" => function($meta) {
foreach ($meta["columns"] as $colName => $colMeta) {
$meta["columns"][$colName]["thousandSeparator"] = " ";
$meta["columns"][$colName]["decimalPoint"] = ",";
}
return $meta; }
)))
->pipeTree(
function ($node)
{
$node->pipe(new Filter(array(array("Etat","=","Prepare")
)))
->pipe(new ColumnRename(array(
"Quantite"=>"Rentres",
"Article"=>"Article_R"
)))
->pipe($this->dataStore("Rentres"));
},
function ($node)
{
$node->pipe(new Filter(array(array("Etat","=","Promis")
)))
->pipe(new ColumnRename(array(
"Quantite"=>"Promis",
"Article"=>"Article_P"
)))
->pipe($this->dataStore("Promis"));
},
function ($node)
{
$node->pipe(new Filter(array(array("Etat","notContain","Pr")
)))
->pipe(new ColumnRename(array(
"Quantite"=>"Sortis",
"Article"=>"Article_S"
)))
->pipe($this->dataStore("Sortis"));
}
);
$join1 = $this->dataStore('Rentres')->leftJoin($this->dataStore('Promis'),array(
"Article_R"=>"Article_P"__
));
}
}