I've defined a global table, like this:
$data['custom_test']['table']['group'] = t('Custom: Test');
$data['custom_test']['table']['join'] = array(
// #global is a special flag which let's a table appear all the time.
'#global' => array(),
);
Next I added a custom field:
$data['custom_test']['test'] = array(
'title' => t('Test'),
'help' => t('Show test field'),
'field' => array(
'handler' => 'custom_test_handler_test_field',
),
With this I could now make a field handler; This field handler adds a subquery:
$this->query->add_field(NULL, "(QUERY)", '(FIELD)');
And with this I can output the result.
However, when I add a filter, (using a default filter handler), the query looks something like:
AND (.test BETWEEN '20' AND '30') ))
So what it does is that it tries to prefix a table, however there are no tables (since it's a subquery).
Is there someway I can fix this by configuration, without having to say build my own filter?