Amazing KoolReport 2.31.7
January 26, 2018If the last version was a big improvement, this new version of KoolReport is even bigger with a lot of changes. Better structure, syntax improvement, new processes, new widget features. All backward compatible so do not hesitate to upgrade KoolReport core.
Widget's dataSource
In the new version, new dataSource
property is introduced to Widget
. dataSource
property can receive various type of source: array, DataStore
object, DataSource
object or even Process
object. Let take Table
widget as an example:
//Normal dataStore
Table::create(array(
"dataSource"=>$this->dataStore("mydata")
));
//From Array
Table::create(array(
"dataSource"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"Karl","age"=>32)
)
));
Table::create(array(
"dataSource"=>array(
array("name","age"),
array("Peter",35),
array("Karl",32),
)
));
//From DataSource
Table::create(array(
"dataSource"=>$this->src("automaker")->query("SELECT * FROM orders")
));
//From Process
Table::create(array(
"dataSource"=>(
$this->src("automaker")
->query("SELECT * FROM orders")
->pipe(new Group(array(
"by"=>"customerId",
"sum"=>"amount"
)))
)
));
The previous dataStore
property is still working so you do not need to change your code when upgrading to new KoolReport version. However, in the future, please utilize the powerful dataSource
property of Widget
.
Table Group Header
One the the most requested feature is to provide the group header for Table
widget. Now you can group some of the columns under a bigger name group.
Table::create(array(
...
"headers"=>array(
array(
"kpi"=>array(
"label"=>"All KPIs",
"colspan"=>"4",
)
),
array(
"visit_kpi"=>array(
"label"=>"Visit KPIs",
"colspan"=>"2",
),
"action_kpi"=>array(
"label"=>"Action KPIs",
"colspan"=>"2"
)
)
),
"columns"=>array("visitors","pageViews","downloads","purchases"),
))
As a result of above code, we have two bigs group which are "Visitor KPIs" and "Action KPIs" and under each, there are two sub columns. "Visitor KPIs" has "visitors" and "pageViews" and "Action KPIs" has "downloads" and "purchases". There is no limitation on number of header level you can group.
New Way To Pipe Process
We have added a static function process()
so beside the old way to create Process, this is the new way:
...
->pipe(Filter::process(array(
array("age",">",35)
)))
->pipe(Group::process(array(
"by"=>"city"
"avg"=>"income"
)))
...
QueryBuilder
QueryBuilder is our new package which helps to generate SQL Query
faster and more precisely. So instead of keying in the raw SQL Query
, now we can use the QueryBuilder
to generate.
$this->src('automaker')->query(
DB::table('payments')->whereYear('paymentDate','2017')
)
The QueryBuilder
package helps you to prevent SQL Injection
and eventually improve the security for your data. The package is free and can be downloaded here.
Note: Although QueryBuilder
is a package of KoolReport, you may download and use it as standalone to generate SQL Query
for your application. It support MySQL, SQLServer and PostgreSQL now. The more SQL language will be added in the future.
Summary
Above are some highlights for new changes, there are number of other changes inside the KoolReport that we did not list here due to the length of the list and there is no visible effect that you can see. But those changes are every important to strengthen the structure of KoolReport so that it can support new kinds of data visualization widgets and new data processes later on.
KoolReport 2.31.7 is a worth version to upgrade. If you upgrade, please also upgrade all packages that you own since the old packages may not work well with new version of KoolReport.
We also released new version of KoolReport Pro 2.31.7. This new version contains the most updated packages and the new packages also. Please download! If you have not owned KoolReport Pro, please consider to get since it is the most valuable suite that you can find for reporting. We keep adding more and more valuable packages to the suite so the price could go up further so better to get it now to secure the price. KoolReport Pro also goes with Full Source-Code and Priority Support.
Oh not to forget, please check out new DrillDown package and new PivotMatrix widget.
Enjoy!
<3 koolreport team