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 Andre,

    That works very well

    Thanks for your knowledge on this - it will be very useful.

    Neil

Reply Children
No Data