KoolReport's Forum

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

How add these items on Drill Down #3128

Open Alan Sawyer opened this topic on on Aug 28, 2023 - 2 comments

Alan Sawyer commented on Aug 28, 2023

I want to add the things that are commented out to my Table in Drill Down.. I can't seem to get the syntax correct.

Any help would be appreciated.

        array(
            //Level 2;
            "title" => function ($params, $scope) {
                return "Year " . $params["year"];
            },
            //           "content"=>function($params,$scope)
            "widget" => array(Table::class, array(
                "dataSource" => function ($params, $scope) {
                    return $this->src("cloud1")->query("
SELECT AL.CategoryEDesc Description,
COUNT(1) Count,
SUM(AL.price20) Total
FROM dbo.Activity A
JOIN Step S ON S.id = A.CurrStepID
JOIN dbo.Company C ON C.id = A.CompanyID
JOIN dbo.ActivityLines AL ON AL.ActivityID = A.ID
where EngagementYear = 2023
AND C.Name = 'Group, LLC'
AND S.ActivityStep = 'Engagement'
AND A.Status = 'A'
AND AL.Disabled = 0
GROUP BY AL.CategoryEDesc
ORDER BY AL.CategoryEDesc
                            ")
                        ->params(array(
                            ":year" => $params["year"]
                        ))   ;
//                        ,
//                        "columns"=>array(
//                            "Description"=>array(
//                          "type"=>"string",
//                                "label"=>"Description"),
//                            "Count"=>array(
//                                "type"=>"number",
//                        "footer"=>"sum",
//                            "footerText"=>"<b>Total:</b> @value"  ,
//                            "cssStyle"=>"text-align:right"
//                            ),
//                            "Total"=>array(
//                              "type"=>"number",
//                                "label"=>"Total",
//                                "prefix"=>"$",
//                            "cssStyle"=>"text-align:right",
//                        "footer"=>"sum",
//                            "footerText"=>"<b>Total:</b> @value"
//                            )
//                        )
//                        ,
//                        "clientEvents"=>array(
//                            "itemSelect"=>"function(params){
//                                saleDrillDown.next({month:params.selectedRow[0]});
                }
            ))
        )

This is for the second level of the drill down. First level is a Chart, but second level is a table. I am using SQL Server. Some query values are hard coded for now. I am trying to get "inputs" figured out so I could change some of the hard coding.

KoolReport commented on Aug 30, 2023

It is lack of close for dataSource function:

"dataSource" => function ($params, $scope) {
               return $this->src("cloud1")
                        ->query("...")
                        ->params(array(
                            ":year" => $params["year"]
                        ));
                }, //<-- this is missing
"columns"=>array(
...
Alan Sawyer commented on Aug 30, 2023

Thanks, Still having issues but it's on my side. I really need a bit of training or help I think. Please contact me.

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