KoolReport's Forum

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

Datasource not found 'MainiDM' using Codeigniter3 #1185

Closed Sowmya opened this topic on on Nov 27, 2019 - 1 comments

Sowmya commented on Nov 27, 2019

Hi KoolReport team,

I am Koolreport Pro User. I am using Codeigniter3, SqlServer to generate Reports...

Here my Database name is "MainiDM", I configured in database.php also. This is only one database in my project. Now I want to generate DrillDown with Example that given in Koolreport examples. But I changed my database name as "MainiDM" and table is "sampledata". I implemented same as example. But it gave the error as "Datasource not found 'MainiDM'"....Report is not generating. Please help me. I have to complete this task as early as possible....Thank You

Here is my code

DrillDown::create(array(
        "name"=>"saleDrillDown",
        "title"=>"Sale Report",
        "levels"=>array(
        	array(
        		"title" => "All Years",
        		"content" => function($params,$scope){
        			ColumnChart::create(array(
        				"dataSource"=>(
        					$this->src("MainiDM")->query("SELECT YEAR(paymentDate) as preyear,sum(amount) as sale_amount 
                                FROM sampledata
                                GROUP BY YEAR(paymentDate)")
        				),
        				"columns"=>array(
        					"year"=>array(
                                "type"=>"string",
                                "label"=>"Year",
                            ),
                            "sale_amount"=>array(
                                "label"=>"Sale Amount",
                                "prefix"=>"$",
                            )
        		),
				"clientEvents"=>array(
                            "itemSelect"=>"function(params){
                                saleDrillDown.next({year:params.selectedRow[0]});
                            }",
                        )
        	));
        }
     ),
Sowmya commented on Nov 28, 2019

I solved my issue, What my mistake is

public function settings()
	{
		return array(
			
            "dataSources"=>array(
                "invoice"=>array(
                    "connectionString"=>"sqlsrv:Server=SQLPC;Database=MainiDM",
                    "username"=>"sa",
                    "password"=>"sa1234",
                    "charset"=>"utf8"
                )
            )
        );
	}

Here I gave dataSource as "invoice", but there I given Database name as dataSource name. That is my mistake...

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

DrillDown