KoolReport's Forum

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

Error message #102

Open zenon opened this topic on on Sep 5, 2017 - 8 comments

zenon commented on Sep 5, 2017

Hi KoolReport,

By any chance do you know what the below errors are about? I did not face these problems in other reports so far except for this two reports.

First report error:-

A PHP Error was encountered

Severity: Notice

Message: A non well formed numeric value encountered

Filename: processes/Group.php

Line Number: 119

Second report error:-

An uncaught Exception was encountered

Type: ParseError

Message: syntax error, unexpected '--' (T_DEC)

Filename: C:\xampp\htdocs\project_file\application\libraries\koolreport\processes\CalculatedColumn.php(91) : eval()'d code

Line Number: 1

By the way, I noticed that after I installed the latest version of KoolReport, then this errors occurred. This is because I have done both the reports above using the previous version. However, the other reports do not have such problems. So I don't think it is related to the latest version.

Hopefully you could help me with this.

Your help is much appreciated.

Thank you.

KoolReport commented on Sep 5, 2017

Could you please post the code of setting up the Group and CalculatedColumn in setup() function?

zenon commented on Sep 5, 2017

Here it is:-

->pipe(new CalculatedColumn(array(
            "1"=>function($data){
                return $data["netsales"]*$data["lastcost"];
            },

            "2"=>"({netsales}>'0')?({netsales}-{lastcost})/{netsales}*100:({netsales}-{lastcost})/{netsales}*-100",
        )))

->pipe(new Group(array(
            "by"=>"dept",
            "sum"=>"desc,qty,grosssales,disc,netsales,cost,qty,sigrosssales,sicn,sinetsales,sicost,totalqty,totalsales"
        )))
KoolReport commented on Sep 5, 2017

For the CalculatedColumn, on the "2", please use the function like the number "1". Also, please use the condition $data["netsales"]>0, not >'0'.

About the Group process, please check if in your sum list, there is boolean value (not numeric value), I suspect the "desc". Just make sure the data in columns you put to sum is number.

zenon commented on Sep 5, 2017

Could you please guide me how to for the CalculatedColumn, as it is an if else statement?

The Group process now is ok.

Thank you.

KoolReport commented on Sep 5, 2017
"2"=>function($data)
{
return ($data["netsales"]>0)?(($data["netsales"]-$data["lastcost"])/$data["netsales"]*100):(($data["netsales"]-$data["lastcost"])/$data["netsales"]*-100);
}
zenon commented on Sep 5, 2017

Ok no more errors. Thank you.

But I was wondering, I did use the previous if else statement in the same report, as well as in other reports, how come there is no errors?

KoolReport commented on Sep 5, 2017

I am not sure it is because of new version or your data. The previous method is using string replacing, for example: {netsales} will be replace with real value 2000 for example. But it may happen that real value can be null for example and it could cause issue. The later method which uses function is better.

zenon commented on Sep 6, 2017

Alright noted. Thanks a lot.

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

None