KoolReport's Forum

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

Passing data between 4 dashboards #2568

Open Mathieu Viennet opened this topic on on Feb 10, 2022 - 1 comments

Mathieu Viennet commented on Feb 10, 2022

Hi Koolreport support,

i'm using Kool Reports Pro + Dashboard.

I need to pass data between 4 dashboards.

I have 1 dashboard with a list of representatives, listing their totals sales. User can click on a table row to go to a second dashboard, which list the clients of those sales. Third Dashboard is the invoices, Fourth Dashboard is the Invoices details.

On the first Dashboard, i pass the Date of the Datepicker, the rep_name and rep_id to the second Dashboard, using this code in the Table fields button :

protected function fields()
    {

        return [

            Text::create("rep_name")->label("Rep Name")->sortable(true),
			Text::create("rep_id")->label("Rep ID"),
            Currency::create("orderNet")->CAD()->symbol()->decimals(2)->label("Sales Amount")->footer("sum")->sortable(true),
            Text::create("orderCount")->label("Orders")->sortable(true),
            Text::create("webOrderCount")->label("Web Orders")->sortable(true),
			Number::create("webPercent")->label("Web Orders %")->sortable(true)->decimals(0),
            Button::create("viewDetails")
                ->type("warning")
                ->label("")
                ->textAlign("right")
                ->text("View Clients")
                ->onClick(function($value, $row){
                    return Client::dashboard("SalesByRepCustomer")->load([
                        "rep_id"=>$row["rep_id"],
						"rep_name"=>$row["rep_name"],
                        "start_date"=>$this->widget()->sibling("SalesByRepDateRange")->value()[0],
                        "end_date"=>$this->widget()->sibling("SalesByRepDateRange")->value()[1]                    
                    ]);
                    
                }),
			
        ];
    }

Here's a screenshot of the first and second Dashboard.

My question is: how do I pass the SAME DATE I used on the datepicker of the first Dashboard to the second, to dashboard 3 and 4. This also needs to work backwards, when i go from 4 - 3 - 2 - 1.

In the Fields of Table, i tried to use : $this->dashboard()->params()["start_date"]) but it's not working.

Thanks for helping!

Mathieu Viennet commented on Feb 12, 2022

Ok, i figured it out by using sessions variables. Please do tell me if there's another way to achieve this. 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

Dashboard