Views Or Filters Drupal 6 tutorial

Views Or allows you to define filter blocks with multiple alternatives in drupal views.

for the video inclined here’s the two minute walk through – http://www.youtube.com/watch?v=pWE78xQK3Z0

A bit sleepy this morning and forgot coffee.  It shows, I know.

Use case: we have some old data – some of it comes in with the number 0 meaning blank, some of the rows contain the word NULL and some of the rows are empty. All three variations mean the same thing. We want to create a single view with all three options open – if it’s the number 0 OR the word NULL or simply empty.

Views Or adds to your filters options

Views Or adds to your filters options

Installation and usage: Install as usual – obviously you’ll need views installed…. To use you will need to add all three of the new fields into your filters block. First will be the “Begin alternatives” then the “Next alternative between your filters, (repeated for as many alternatives as you need) and lastly you’ll need to “end alternatives.”

Views or fields in the filters area

Views or fields in the filters area


All the pretty fields need to be reorganized

All the pretty fields need to be reorganized

As a lazy lad I like to just add them all at once and then move the options around afterwards, do whatever your gods tell you to…

The final views or arrangement

The final views or arrangement

Programmatically what this has achieved is

AND ((UPPER(node_data_field_er_acq_uid.field_er_acq_uid_value) = UPPER(‘NULL’)) OR (node_data_field_er_acq_uid.field_er_acq_uid_value IS NULL))

In any case it’s a pretty simple module – installs well and saved us from cruddy data. Merci a bunch to all

This entry was posted in Planet_Drupal and tagged , , , , . Bookmark the permalink.

4 Responses to Views Or Filters Drupal 6 tutorial

  1. Pingback: Drupal 6 + Modules we Love Volume 1, Views | Wordpress VS Drupal

  2. Daniel says:

    You should know that views3 in drupal6 has this feature native built in.

  3. Rik says:

    Thanks for this. Sounds like a very useful little module!

    On the topic of Views and filters, this recent module may come in handy too: Views Global Filter

    Rik