[development] views: custom conditions using fields from multiple tables

Ken Rickard agentrickard at gmail.com
Fri Jul 8 17:24:27 UTC 2011

I think this is a fair development question, since the answer is "you
have to write code to do this".

You can do variable query handlers in custom field handlers -- that's
what I usually do -- but it does require writing code.

Essentially, your query() method can be responsive to input or
conditions in the rest of the View (including arguments.)

Here's a snippet that (while out of context) will show you the basic approach.


If you think your logic can be abstracted and used in multiple places,
a Views filter is a great option. If not, just a custom query is fine.

On Thu, Jul 7, 2011 at 4:30 PM, Ms. Nancy Wichmann
<nan_wich at bellsouth.net> wrote:
> This should be in the Support list.
> I believe using the "Relationship" stuff would allow this, but you may have
> to build a module to provide that information. In which case, doing your own
> query is probably faster.
> Nancy
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
> Jr.
> From: Roman Zimmermann
> for a site specific view I'd need to implement a view which's query
> has a condition that spans multiple tables. It'll look something like:
> table1.field = 'value' OR table2.field = 'other value'
> Is this possible using D6/views2 ?
> Am I better off just using a custom query?

Ken Rickard
agentrickard at gmail.com

More information about the development mailing list