KoolReport's Forum

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

Create dynamic function to create reports (CodeIgniter) #98

Open tee opened this topic on on Aug 30, 2017 - 3 comments

tee commented on Aug 30, 2017

Hi support team,

In order for me to make dynamic of report's name - "purchase_report (number)", I came out the codes as shown below. At the end, i don't have to create similar function again to read different report name. So far i got error. I need your help whether you have better solution to solve it? Appreciate you.

public function generate_report() 
{ 
    $childnode = $this->input->post('childnode');
    $mothernode= $this->input->post('mothernode');
    $report = new purchase_report .$childnode. (array(
                'mothernode' => $mothernode,
                ));
    $report->run()->render();
}
tee commented on Aug 30, 2017

I have found the solution.

KoolReport commented on Aug 30, 2017

My solution is that

$report_name = "purchase_report".$childnode;
$report = new $report_name(array(...));
...

What is your solution?

tee commented on Aug 30, 2017

Similar with yours, thanks.

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