KoolReport's Forum

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

Problem with pivot table #204

Open kezern opened this topic on on Jan 27, 2018 - 1 comments

kezern commented on Jan 27, 2018

I'm trying to build a pivot report from an array. I have read this pivot doc But I would like a complete example to see it. I have created a datasource as usual, in fact when I show it in a table report it works fine. when I try to create a pivot table

$node = $this->src('sales')
            ->query("SELECT num1, num2, num3, num4
              FROM mydata");
            ->pipe(new Pivot(array(
              "dimensions" => array(
                "column" => "num1, num2"//,
                //"row" => "customerName, productLine"
              ),
              "aggregates"=>array(
                "sum" => "num3,num4"//,
                //"count" => "dollar_sales"
              )
            )))
            ->pipe($this->dataStore('test2'));

I get

Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)"

in this line

->pipe(new Pivot(array(
KoolReport commented on Jan 28, 2018

Please remove the ";" in the line "FROM mydata");"

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

Pivot