KoolReport's Forum

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

Different views as different pages #1832

Open George opened this topic on on Jan 9, 2021 - 2 comments

George commented on Jan 9, 2021

Happy new year everyone,

I have two reports with various items on each one . Is it possible to have a main Report page with links to other pages ? For example right now I have a Report that shows items that concern year 2020, now that the year is turned I want to create a new page report for 2021 records (same queries but with date filter). Is it possible to have a central report page that contains links to yearly records ? In the documentation I see One Report Different Views but it refers to display the data in the same page, is there a way to split the result pages by year for example ?

I hope I made that clear enough.

Sebastian Morales commented on Jan 11, 2021

George, you could use multiple links to the same report page but with different parameter values:

https://host/path/to/myPage.php?year=2020

https://host/path/to/myPage.php?year=2021

Then in your report you could catch the year parameter and pass it to your query:

//myPage.php
$year = $_GET["year"];
$report = new MyReport(array(
    "year" => $year
)):

//MyReport.php
...
    public function setup()
    {
        $year = $this->params["year"];
        ...

Pls let us know if we understand your question correctly.

George commented on Jan 11, 2021

Thank you Sebastian,

I forgot to mention also that I'm using codeigniter framework if that is any additional problem . Basicaly I don't want to have to create a new controller for each new year in order to call the report from there . I was thinking something in the idea of using for example a drop down control to select the year from a master view and then call the controller function with the year as you describe. I guess trying is the only way to see if it's doable , thanks for the suggestion!

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