KoolReport's Forum

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

I am facing issue implementation in custom drilldown report #464

Open Rajat Goel opened this topic on on Sep 13, 2018 - 16 comments

Rajat Goel commented on Sep 13, 2018

showing Undefined index: @drilldown when i am implementing below code

<?php 
    //CountrySale.view.php
    use \koolreport\widgets\google\ColumnChart;
    $drilldown = $this->params["@drilldown"]
?>

<level-title>All Countries</level-title>

<?php
ColumnChart::create(array(
    "dataSource"=>$this->dataStore("sale_by_country"),
    "clientEvents"=>array(
        "itemSelect"=>"function(params){
            $drilldown.next({country:params.selectedRow[0]});
        }"
    )
))
?>
KoolReport commented on Sep 13, 2018

Could you please post your full code of how you initiate the CustomDrillDown. We do have the example for CustomDrillDown, are you able to run it.

Rajat Goel commented on Sep 13, 2018

Hi,

here is the full code summary

<?php

//LoanSummary.php

require APPPATH . "/libraries/koolreport/autoload.php";

use \koolreport\clients\Bootstrap;

use \koolreport\processes\Group;

use \koolreport\processes\Sort;

use \koolreport\processes\Limit;

class LoanSummary extends \koolreport\KoolReport {

function settings() {

    include "config_database.php";
    return  $database_connection;
}

function setup() {
    //Now you can access database that you configured in above
    $CI = &get_instance();
    $CI->db->get('loan_forms');
    
    $query = $CI->db->last_query();
    $this->src("automaker")
            ->query($query)
            ->pipe(new Limit(array(10)))
            ->pipe($this->dataStore('att'));
}

} ?> <?php

//LoanSummary.view.php

use \koolreport\widgets\google\ColumnChart;

$drilldown = $this->params["@drilldown"];

?> <div class="row justify-content-md-center">

<div class="col-lg-12 ">
    <div class="card">
        <div class="card-header">Drill Down</div>
        <div class="card-body">
            <level-title>All Loan Type</level-title>
            <?php
            ColumnChart::create(array(
                "dataSource"=>$this->dataStore("amount"),
                "clientEvents"=>array(
                    "itemSelect"=>"function(params){
                        $drilldown.next({loan_forms:params.selectedRow[0]});
                    }"
                )
            ))
            ?>
        </div>
    </div>
</div>                  

</div>

KoolReport commented on Sep 13, 2018

This should be subreport which will be included by the main report, the main view report contains CustomDrillDown that will render this subreport. When CustomDrillDown render this subreport the params["@drilldown"] will be available. Please look detail into our example of customdrilldown, you will find the MainReport

Rajat Goel commented on Sep 14, 2018

i have implemented as said me but i got errror

Fatal error: Call to undefined method MainReport::subReport() in C:\xampp_new\htdocs\loan\application\libraries\koolreport\packages\drilldown\CustomDrillDown.tpl.php on line 25

<?php //MainReport.php require APPPATH . "/libraries/koolreport/autoload.php"; use \koolreport\clients\Bootstrap; use \koolreport\processes\Group; use \koolreport\processes\Sort; use \koolreport\processes\Limit;

class MainReport extends \koolreport\KoolReport {

//use \koolreport\clients\Bootstrap;
function settings()
{
    return array(
        "assets" => array(
            "path" => "../../assets",
            "url" => base_url('assets'),
        ),
        "subReports"=>array(
            "countrysale"=>CountrySale::class,
            "statesale"=>StateSale::class,
        ),
    );
}

 function setup()
{

}

} ?>

<?php

//MainReport.view.php
use \koolreport\drilldown\CustomDrillDown;

?>

Sale By Location "locationSale", "title"=>"Sale By Location", "subReports"=>array("countrysale","statesale"), )) ?>
KoolReport commented on Sep 14, 2018

In the MainReport, please add:

use \koolreport\core\SubReport;
Rajat Goel commented on Sep 14, 2018

thank you for your reply but can you tell where I have to paste this code

1)MainReport.php

Or

2)MainReport.view.php

KoolReport commented on Sep 14, 2018

It is inside MainReport.php like this:

class MainReport extends \koolreport\KoolReport
{
    use \koolreport\core\SubReport;
    ...
}
Rajat Goel commented on Sep 14, 2018

I have implemented as you said but one error has come

A PHP Error was encountered Severity: Error

Message: Class 'CountrySale' not found

Filename: core/SubReport.php

Line Number: 59

Backtrace:

Rajat Goel commented on Sep 14, 2018

I have implemented country sale report but I am not able to go state sale report please guide me

KoolReport commented on Sep 15, 2018

Do you have any JS error when you go to sate report.

Since what you are doing now is the same with our example of CustomDrillDown, you can just copy the code and modify as you need.

Rajat Goel commented on Sep 16, 2018

No, I did not get any error when I am trying to 2nd stage

Rajat Goel commented on Sep 19, 2018

can u tell me how to show 3 column data on hover this is my view page

Rajat Goel commented on Sep 20, 2018

Any luck...

KoolReport commented on Sep 20, 2018

I have not understood your requirement. Could you please describe clearer. Just a comment when I look at your code is that the $drilldown.next() will have a object params containing variable for next level. For example if the first level is columnchart showing per capita for country. When user select a column for example "USA" then you can pass country "USA" to the next level with next() function. $drilldown.next({country:params.selectedRow[0]});. As you can imagine a table behind the ColumnChart, the first column is the country. so selectedRow[0] mean that sending the country column on a row to next level.

Rajat Goel commented on Sep 21, 2018

I want to show three label on hover column chart

KoolReport commented on Sep 21, 2018

Do you mean on the label, you want to have another text line?

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

DrillDown