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.
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.
Unfortunately it is not possible in an upgrade safe way.
Hi Vinod,
If you want to get only records which are having data you can add appropriate filters to filter section like "Is Not Empty" to the specific fields you are using while creating the report. so this gives a report with results which is having only data. Or else if this doesn't works if you are trying to export it as excel you can do it in excel on your system after downloading it by replacing the empty values with Not Applicable value.
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';
}
}
}
}
Thank you very much, Let me try this one.
Sure, I forgot to mention that this will be applied for all reports for that module by default, so you may want to customize this further if you need it only for one report. Use the contents from $arguments and $bean to know which report this is for.
Let us know how it goes!