Hello, I created (with great help from you) a report using a query with parameters, then Cube. After I pipe to Calculated Columns. I use the long form (function for calculation). When the query parameter is % , large array of data, no problem. If i use a query parameter who gives a smaller array of data, I have msg of error about undefined indexes coming from Cube in the result of Calculated Column *Notice: Undefined index: Detruit in /home/u521225422/domains/phammadmin.com/public_html/reports_phamm/reports/_phamm/test/test.php on line 84
Notice: Undefined index: Perdu in /home/u521225422/domains/phammadmin.com/public_html/reports_phamm/reports/_phamm/test/test.php on line 84
Notice: Undefined index: RemisAMembre in /home/u521225422/domains/phammadmin.com/public_html/reports_phamm/reports/_phamm/test/test.php on line 84* But I get the result after the messages! I thought that using long form with fonction should avoid that issue. Is It an error from me ? Or a bug ? Here is my php program :
public function setup()
{
$this->src('phamm')
->query("
SELECT
items.item as Item,
items.balance as Stock,
CONCAT (items.item,'. Stock : ',items.balance) as Article,
batches.quantity AS Quantite,
batches.etat as Etat
FROM
items
INNER JOIN batches ON (items.id = batches.item)
WHERE
items.item LIKE :Sel_Article
AND
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 Sort(array(
"Article"=>"asc"
)))
->pipe(new Cube(array(
"rows" => "Article",
"columns" => "Etat",
"sum" => "Quantite",
)))
__ ->pipe(new CalculatedColumn(array(
"Sortis"=>array(
"exp"=>function($data){
return $data["Expedie"]+$data["Detruit"]+$data["Perdu"]+$data["RemisAMembre"];
},
"type"=>"string",
)
)))__
->pipe(new RemoveColumn(array(
"Expedie","Detruit","Perdu","RemisAMembre","{{all}}"
)))
->pipe(new CalculatedColumn(array(
"Balance"=>array(
"exp"=>function($data){
return $data["Prepare"]-$data["Sortis"];
},
"type"=>"string",
)
)))
->pipe(new ColumnMeta(array(
"Prepare"=>array(
"type"=>"number"),
"Promis"=>array(
"type"=>"number"),
"Sortis"=>array(
"type"=>"number"),
"Balance"=>array(
"type"=>"number"),
)))
->pipe(new \koolreport\processes\Map(array(
"{meta}" => function($meta) {
$meta["columns"]["Prepare"] = ["label" => "Rentres"];
$meta["columns"]["Promis"] = ["label" => "Promis"];
$meta["columns"]["Sortis"] = ["label" => "Sortis"];
$meta["columns"]["Balance"] = ["label" => "Balance"];
return $meta;
}
)))
->pipe($this->dataStore("stocks"));
}
}
I tried type "number" for the calculated column "Sortis", no way !
There is no emergency with this issue ... enjoy summer ! Kind Regards François