KoolReport's Forum

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

DateRange picker before drilldown? #486

Open Jure Zakrajsek opened this topic on on Oct 4, 2018 - 1 comments

Jure Zakrajsek commented on Oct 4, 2018

Hi

I have a question. Is it posible to add a daterange picker before the drilldown report? Do you perhaps have any examples how this could work?

Thank you Jure

KoolReport commented on Oct 5, 2018

Hi Jure,

Here is the sample code to get DrillDown take into account the dateRange or any other inputs.

<?php
DrillDown::create(array(
    "scope"=>array(
        "dateRange"=>$this->params["dateRange"]
    ),
    "dataSource"=>function($scope)
    {
        return $this->src("mydb")->query("
            select * from table where date in (:range)
        ")->params(array(
            ":range"=>$scope["dateRagge"]
        ));
    },
    ...
));
?>

So as we see in here, the "dateRange" parameter will be saved in to $scope of drilldown and be used inside "dataSource" property. The dataSource is declared as function and in there you can use the $scope to change the query.

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
None yet

None