Need to customize the reports

I am creating a report and as result i am getting all correct data. but i have an requirement that if there is an blank value in any column then i need to put "Not Applicable"

How can we customize the report results.

Parents
  • This is definitely possible and quite easy as well.

    Reports will call a logic hook for each row that gets displayed for a module. All you have to do is to create such logic hook and add your custom logic there.

    The name of the logic hook is: process_report_row. It's just like any other logic hook:

    $hook_array['process_report_row'] = Array();
    $hook_array['process_report_row'][] = Array('1', 'Process Report Row for Module','custom/modules/Accounts/ProcessReportRow.php','ProcessReportRow','execute');

    Then create the file and update the row that is generated out of the report:

    class ProcessReportRow
    {
    function execute(&$bean, $event, &$arguments)
    {
    foreach ($arguments['row'] as $key => $value) {
    if (empty($value) && stripos($key, 'FIELD_DISPLAY_USED_IN_REPORT') !== false) {
    $arguments['row'][$key] = 'N/A';
    }
    }
    }
    }
Reply Children