Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Please view this topic.
based on this topic above, my question is how to use data from basereport's datastore in childreport without resetup this in childreport's 'setup' method.
for example, this is my "basereport.php":
class BaseReport extends \koolreport\KoolReport
{
function settings()
{
return array(
"dataSources"=>array(
"sale"=>array(...),
"marketing"=>array(...),
"other_source"=>array(...),
)
)
}
function setup()
{
$this->src("sale")
->pipe($this->dataStore("abcdefg"));
}
}
how to call $this->dataStore("abcdefg")
in "childReport.view.php" without re-setup these datastore ini "childReport.php"?
Here is the sample code
class BaseReport
{
function settings()
{
return array(
"dataSources"=>array(
"sale"=>array(...),
"marketing"=>array(...),
"other_source"=>array(...),
)
);
}
}
class ParentReport extends BaseReport
{
use \koolreport\core\SubReport;
function setup()
{
$this->src("sale")->pipe(...)
}
}
class ChildReport extends BaseReport
{
function setup()
{
$this->src("sale")->pipe(...)
}
}
let say, i've define datastore named "abcdef" on ParentReport.php like this:
class ParentReport extends BaseReport
{
use \koolreport\core\SubReport;
function setup()
{
$this->src("sale")->pipe($this->dataStore("abcdefg"))
}
}
and that dataStore was used in ParentReport.view.php
my question is, how if i wrote ChildReport.php and ChildReport.view.php which is ChildReport.view.php want to used the 'abcdefg' ParentReport's datastores. should i re-write $this->src("sale")->pipe($this->dataStore("abcdefg"))
on ChildReport.view.php?
ChildReport should be independent from ParentReport. It should be able to standalone with its own data query. It is possible to transmit dataStore of parent to child report but when subReport is updated via ajax, those data will not be available. That's why it should be an independent report. Please rewrite the pipe in childreport.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo