KoolReport's Forum

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

CleanData binding problem >> FillNull #117

Open bysystem opened this topic on on Sep 25, 2017 - 6 comments

bysystem commented on Sep 25, 2017

Dear Support team,

I have some NULL values in my database table which I would like to fill with 0 (zero). The new package seems to be perfect for this job. Therefore I just have downloaded the new package cleandata, unziped and copied it into the \koolreport\packages folder:

Then I've added "FillNull" by piping and "use..." as follows:

<?php

require_once "../koolreport/autoload.php"; use \koolreport\processes\Filter; use \koolreport\processes\ColumnMeta; use \koolreport\pivot\processes\Pivot; use \koolreport\processes\Group; use \koolreport\processes\Sort; use \koolreport\processes\Limit;

class abs extends koolreport\KoolReport {

use \koolreport\clients\FontAwesome; //für die Collapse + icons
use \koolreport\clients\Bootstrap;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
use \koolreport\export\Exportable;
use \koolreport\cleandata\FillNull;

... ... ...

function setup()
{

... ... ...

	->pipe(new FillNull(array(
		"newValue"=>0
	)))
	
	->pipe($this->dataStore('Reporting.Report_ABS')); 

... ...

But unfortunately I get a blank white page as a result!

What I'm doing wrong here?

Kind regards

KoolReport commented on Sep 25, 2017

Not forget to mention, CleanData package works with latest KoolReport 1.61.2 only. Please try to upgrade. All other packages still work well with new version of KoolReport.

bysystem commented on Sep 25, 2017

Thx a lot for the important hint!

I just have upgraded to the current vers. 1.61.2 and results are shown now.

But it still does not exactly what I need. I have the following table results in my MS SQL database with NULLs in some of the rows:

And the output are still only the rows which are NOT NULL (see below) allthough I have the following in my code (only the last column are filled with 0):

->pipe(new FillNull(array(
	"newValue"=>0
)))

What I would like to have is taht ALL THE NULLs have the newValue = 0 so that also these rows are listed as well in my pivot table as 0 (zero) values like here:

Is there any way to do this?

bysystem commented on Sep 25, 2017

I got it now!

I added the field "ProductNumber" (like VBA... etc.) into the row in my Pivot dimension and now I can see the missing Zero values.

Kind regards

KoolReport commented on Sep 25, 2017

That's great to hear it working well. Anything please let us know.

zenon commented on Sep 26, 2017

Hi KoolReport,

Does this package work if I want to blank the field if the value is zero?

Thanks.

KoolReport commented on Sep 26, 2017

You may try to do this:

-pipe(new FillNull(array(
    "targetValue"=>0,
    "newValue"=>null,
)))

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
solved

CleanData