1

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?

0

I ended up creating a filter class, since I use a subquery I needed to use HAVING rather than BETWEEN.

  • But how did you solve the problem of it referencing a table? – frazras Jul 2 '19 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.