Filter on empty date in ListView

When building a filter in ListView, the date field filter options do not include Is Empty/Is Not Empty options (as it does in Reports)

Sugar Support have logged this as a defect/enhancement

Does anyone have a way of dealing with this. It is a basic business requirement to list records which don't have a date field completed.

My specific requirement involves a number of date fields so I want to avoid creating a custom calculated field (which would be an option if only one field involved) which I could filter on (eg date present)

Thanks 

Parents
  • Hi Neil Conacher 

    I believe you can create a custom filter operators (custom/clients/base/filters/operators/operators.php) and set the operators $empty and $not_empty for date type fields:

    <?PHP

    include 'clients/base/filters/operators/operators.php';

    $viewdefs['base']['filter']['operators']['date']['$empty'] = 'LBL_OPERATOR_EMPTY';

    $viewdefs['base']['filter']['operators']['date']['$not_empty'] = 'LBL_OPERATOR_NOT_EMPTY';

    $viewdefs['base']['filter']['operators']['datetime']['$empty'] = 'LBL_OPERATOR_EMPTY';

    $viewdefs['base']['filter']['operators']['datetime']['$not_empty'] = 'LBL_OPERATOR_NOT_EMPTY';

    $viewdefs['base']['filter']['operators']['datetimecombo']['$empty'] = 'LBL_OPERATOR_EMPTY';

    $viewdefs['base']['filter']['operators']['datetimecombo']['$not_empty'] = 'LBL_OPERATOR_NOT_EMPTY';

    Go to Admin -> Repar -> "Quick Repair and Rebuild" / "Clear Additional Cache" after saving this file.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André, under certain conditions the filter allows only empty and not empty with your code. I had that issue in 10.1 and had to check $viewdefs to be not empty (see my answer below).

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Reply Children
No Data