KoolReport's Forum

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

Pivot matrix init #2706

Closed Edp Ferrino opened this topic on on Jun 6, 2022 - 4 comments

Edp Ferrino commented on Jun 6, 2022

Hello, I have a PivotMatrix that immediately displays the maximum detail of my visualization. But I don't want it to be like this right away. I attach two images. The first is how the page loads now, the second is how I would like the page to load.

Edp Ferrino commented on Jun 6, 2022

My code:

protected function setup()

{
	$sql      	= "";
	$sql_core 	= $this->GetSQLFatturato(); 
	$parametri 	= array(":data_inizio" => $this->data_inizio, ':data_fine' => $this->data_fine);
	$sql = "select a.NAZIONE, a.ANNO, a.PEZZI, a.FATTURATO, a.GRUPPOFAM, a.FAMIGLIA from (" . $sql_core . ") a";

    $this->src('dati_produzione')
		->query($sql)
		->params($parametri)
		->pipe(new Pivot(array(
			"dimensions" => array(
			"row" => "NAZIONE, GRUPPOFAM, FAMIGLIA",
    		"column" => "ANNO"
		),
		"aggregates"=>array(
			"sum" => "PEZZI, FATTURATO", 
		)
	)))     
  	->pipe($this->dataStore('my_pivot'));  
}
Edp Ferrino commented on Jun 6, 2022

No solution?

Sebastian Morales commented on Jun 7, 2022

In your report'setup's Pivot process, use only NAZIONE for "row" like this:

//MyReport.php
		->pipe(new Pivot(array(
			"dimensions" => array(
			    "row" => "NAZIONE",
    		            "column" => "ANNO" 
		    ),
		    "aggregates"=>array(
			"sum" => "PEZZI, FATTURATO", 
		    )
	)))

Meanwhile, in your report view's PivotMatrix widget, set "waitingFields" like this for them to appear at the top:

PivotMatrix::create(array(
        ...
        'waitingFields' => array(
            'GRUPPOFAM' => 'label',
            'FAMIGLIA' => 'label',
        ),
));
Edp Ferrino commented on Jun 7, 2022

Solved. Thank you

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
None yet

None