KoolReport's Forum

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

KoolReport not show anything in table #2206

Open Rohit Savaliya opened this topic on on Jul 13, 2021 - 3 comments

Rohit Savaliya commented on Jul 13, 2021

We generate a report and there is not show anything in the table, only report structure is visible without data. like bellow pic.

For reference here i mention the code we run.

$jobsheet 		= $this->src('mysql')->query($Query1); // 25796 record
$attandance 	= $this->src('mysql')->query($Query2); // 4392 record
$delimiter = " || ";
$join = new Join($jobsheet,$attandance,array("engg_reassigned_to"=>"engg_reassigned_to"));
$join->pipe(new Pivot2D(array(
	"dimensions"=>array(
		"column" => "dateyear",
		"row" => "users_zone_c, address_state, CSCName,engName",
	),
	"aggregates"=>array(
		"sum" => "ProductiveJS, workingDays, Average",
	),
	"fieldDelimiter" => $delimiter,
))) 
->pipe(new Map(array(
'{value}' => function ($row) use ($delimiter) {
	foreach ($row as $colName => $colValue) {
			$colFields = substr($colName, 0, strrpos($colName, " || "));
			$customAverageColName =  $colFields . " || Average - sum";
			if($customAverageColName!==' || Average - sum'){
				$row[$customAverageColName] = $row[$colFields . " || ProductiveJS - sum"] != 0 ? $row[$colFields . " || ProductiveJS - sum"] / $row[$colFields . " || workingDays - sum"] : 0; 
			}
	}
	return $row; 
},
	'{meta}' => function($meta) {
		$meta['columns']['Average - sum'] = array(
			'type' => 'number',
			'decimals' => 2,
		);
		
			return $meta;
	}
)))
->pipe($this->dataStore('productivity'));

I also try to fix the issue and found that if

$this->dataStore('productivity')->data();

does not return anything then koolreport not show anything. in my case it is not show anything but array(0) { }

buy my both queries are run successfully in sql and give me numbers of record. Please help us to fix this issue

Sebastian Morales commented on Jul 13, 2021

Pls try to comment out the Pivot2D and/or Map process and see if $this->dataStore('productivity')->data(); shows any data row. Rgds,

Rohit Savaliya commented on Jul 13, 2021

1) When i comment out only Map process process it is still show me array(0) { }

2) when i comment out only Pivot2D process it show me error bellow

3) when i comment out both Map process & Pivot2D process the same error like above image.

Please help us to fix this

Sebastian Morales commented on Jul 14, 2021

When commenting out the Pivot2D process, pls also remove the PivotMatrix widget in your report view. In your report view pls only output the datastore's data to see if there's any. Tks,

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