KoolReport's Forum

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

Changing cell values according to other column #3271

Open Adolfo Alonso opened this topic on on Mar 20 - 3 comments

Adolfo Alonso commented on Mar 20

Hello, I have the following report exported in PDF:

What I need is that when the KMS column is 0, then all the following values in red should be either 0 or 00:00:00

How can I achieve this? As always thanks.

Sebastian Morales commented on Mar 21

Supposed you use the core Table widget, there's a "formatValue" property of columns that allows users to change a column value based on the current data row like this:

    Table::create(array(
        ...
        "columns"=>array(
            "amount"=>array(
                'formatValue'=>function($value, $row, $cKey)
                {
                    //return a custom value based on the current $row and column name $cKey
                    return $customValue;
                }
            ),
        ),
        ...
    )); 
Adolfo Alonso commented on Mar 21

By core Table Widget do you mean DataGrid DataTable?

Sebastian Morales commented on Mar 22

By core Table I meant \koolreport\widgets\koolphp\Table:

https://www.koolreport.com/docs/koolphp/table/#table-settings-format-column-value

\koolreport\datagrid\DataTables also has column formatValue option:

https://www.koolreport.com/docs/datagrid/datatables/#format-column-value

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