[development] howto views filter null timestamps

andrew morton drewish at katherinehouse.com
Tue Feb 9 21:24:43 UTC 2010


You need a filter that uses COALESCE(fieldname, 0) = 0 to convert
NULLs into zeros. I think the numeric filter has this ability.

andrew

On Tue, Feb 9, 2010 at 5:55 AM, Lluís <enboig at gmail.com> wrote:
> I have coded a content-type and I want to filter it using views. I
> have to check if a timestamp field is 0 or NULL (I can change de
> coding). Is there any way of doing so?
>
> My field views definition is:
>
>  $data['node_mynodetype']['first_read'] = array(
>    'real field' => 'first_read',
>    'title' => 'First time the node was read',
>    'help' => '.',
>    'field' => array(
>      'handler' => 'views_handler_field_date',
>      'allow empty' => TRUE,
>      'click sortable' => TRUE,
>    ),
>    'sort' => array(
>      'handler' => 'views_handler_sort_date',
>    ),
>    'filter' => array(
>      'handler' => 'views_handler_filter_date',
>    ),
>  );
>
> thanks
>
> --
> *Les normes hi són perquè hi pensis abans de saltar-te-les
> *La vida és com una taronja, què esperes a exprimir-la?
> *Si creus que l'educació és cara, prova la ignorància.
> *La vida és com una moneda, la pots gastar en el que vulguis però
> només una vegada.
> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>


More information about the development mailing list