Hello, I am having a hard time understanding how to make KoolReport work. I have managed to get the examples working on my server, but these are connected to static data in CSV or some other form. I want to simply use the examples and modify them to suit my purpose.
I downloaded KoolReport and have inserted here the file for the "Minimum Settings" table.
<?php
//Step 1: Load KoolReport
require_once "../../../load.koolreport.php";
//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
protected function settings()
{
return array(
"dataSources"=>array(
"data"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"table",
"data"=>array(
array("name","age","income"),
array("John",26,50000),
array("Marry",29,60000),
array("Peter",34,100000),
array("Donald",28,80000),
)
)
)
);
}
protected function setup()
{
$this->src("data")
->pipe($this->dataStore("data"));
}
}
How do I convert this table to use my data?? The examples given on with the example table aren't clear to me.
Getting started with Table is very easy! All you need to do is to provide "dataSource" for table, for example:
<?php
Table::create(array(
"dataSource"=>$this->dataStore('data')
));
?>
Use SQL Query
Table can receive direct query, for example:
<?php
Table::create(array(
"dataSource"=>$this->src("mysql_database")->query("select * from orders")
));
?>
Use Array
<?php
Table::create(array(
"dataSource"=>array(
array("name","age"),
array("Peter",35),
array("John",36)
)
));
?>
or associate array
<?php
Table::create(array(
"dataSource"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"John","age"=>36)
)
));
?>
The examples given look nothing like the actual files that are supplied in the downloaded files. Are there any step by step instructions for people who are not computer programmers to use?? This is not easy for me to grasp with the tutorials supplied. The examples are wonderful if I could use them. I would by=uy the Pro version but don't want to pay for something I won't be able to easily use.
Thank you for any help.
Ray