Views contextual filters programmatically alter add to or I have 2 fields in my contextual filters. Obviously, the default join is AND but I'd like to filter on one or the other field depending on which one of two arguments is provided.

I tried the following approach:

function mymodule_views_query_alter(&amp;$view, &amp;$query){

    if($view-&gt;name == 'my_links'){
        switch ($view-&gt;current_display) {
            case 'page_2':
                // dsm($query, 'Query');
                $query-&gt;where[0]['type'] = 'OR';
            break;

            default:
                # code...
            break;
        }
    }
}


However, using the devel module to inspect the Views data, the type field in the where section of my View still outputs AND instead of OR.

Which means my attempts to alter my View is not working.

Can anyone help me get this working?
If you have a way of knowing both filter values (like NULL and 12), then I would use hook_views_pre_build and unset the NULL field.

function test_views_pre_build(&amp;$view) {
  // Do some checks for view name and current_display
  unset($view-&gt;display_handler-&gt;handlers['argument']['null_field']);
}