KoolReport's Forum

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

Subreport update columns lose formatting #2792

Closed Andrew Guattery opened this topic on on Aug 13, 2022 - 1 comments

Andrew Guattery commented on Aug 13, 2022

I have a table that is a subreport where the data is coming from an MSSQL query. The table create is like this:

Table::create(array(
       "name" => "table1",  
           "dataStore"=>$this->dataStore("paybyp"), 
           "sorting"=>array(
        "PERIOD_DT"=>"asc"
    ),
           "columns"=>array(
           "STR_ID"=>array(
           "type"=>"string",
           "label"=>"Store"
           ),
           "USR_ID"=>array(
           "type"=>"string",
           "label"=>"User ID"
           ),
           "PERIOD_DT"=>array(
           "type"=>"datetime",
           "label"=>"Clock Date",
           "formatValue"=>"m-d-Y"
           ),
           "CLOCK_IN"=>array(
           "type"=>"string",
           "label"=>"Clock in"
           ),
           "CLOCK_OUT"=>array(
           "type"=>"string",
           "label"=>"Clock out"
           ),
           "PD_HRS"=>array(
           "type"=>"int",
           "label"=>"hours"
           ),
           "TOTAL"=>array(
           "type"=>"int",
           "label"=>"Total Hours"
           )
           ),
           "grouping"=>array(
           "USR_ID","USRNAME"=>array(
           "calculate"=>array(
           "{pdhrsAmount}"=>array("sum","PD_HRS"),
           "{totalhoursAmount}"=>array("sum","TOTAL"),
           ),
           "top"=>"<b>PD HRS {USRNAME}</b>",
           "bottom"=>"<td><b>Total for user {USRNAME}</b></td><td></td><td></td><td></td><td></td><td><b>{pdhrsAmount}</b></td><td><b>{totalhoursAmount}</b></td>"
           ),
           ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered",
            "th"=>"cssHeader",
            "tr"=>"cssRow",
        )//End cssClass
        
    ));//End Table::create

When the report first loads you can see the column headers of the subreport and they are all correct ("Store","User ID", etc) but when I call subreport.update to load the data all of the column formatting is lost and the column names go back to the ms-sql column names. Also, the php error log is filled with this notice and warning once for each column: PHP Notice: Undefined index: STR_ID in C:\inetpub\wwwteam\koolreport\pro_5.16.2\koolreport\core\src\widgets\koolphp\Table.php on line 397 PHP Warning: array_merge(): Expected parameter 1 to be an array, null given in C:\inetpub\wwwteam\koolreport\pro_5.16.2\koolreport\core\src\widgets\koolphp\Table.php on line 397

I'm missing something, but I cannot figure it out. the data that loads is correct

Andrew Guattery commented on Aug 14, 2022

So decided rather than debugging this I would change the report from Table to Datatable to make use of new features

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