I have been successfully using this module when the initial value of the populating field was 1 for a greater than assertion. This module rocks.

Just put in place a less than, giving the initial value a 9999. However, it comes through as just 9 oddly.
I've double checked the query in the DB and the only thing stopping the view from populating items is this 9 value incorrectly coming the populate filter input.

Make any sense why it would force a single digit?

Comments

doublejosh’s picture

Tried forcing it with a form_alter which changes what's displayed in the filter, but doesn't fix the query.

function MODULE_form_views_exposed_form_alter(&$form, &$form_state) {
  $f = 'FIELD';
  if(array_key_exists($f,$form)) {
    $form[$f]['#value'] = '9999';
  }
}
doublejosh’s picture

Confirmed that the query always gets only a single digit via pre_execute. Even when exposed and a new value (like 777) is entered, it comes through as 7 in the query.

function MODULE_views_pre_execute(&$view) {
  switch($view->name) {
    case 'MYVIEW' :
      dsm($view->build_info);
      dsm($view->query);
      break;
  }
}
doublejosh’s picture

Hmmm...
Confirmed that the correct value IS being passed from the exposed populate filter into the real fields via dsm($view->filter); as well as all the "exposed" view attributes ie. $view->exposed_input at both the pre_execute and pre_render hook level.

It's in $view->build_info where the value has changed to single digit. Assuming this is a good indicator of where the problem is, but not where to go next.

doublejosh’s picture

Issue summary: View changes

typos

doublejosh’s picture

Title: Populate filter passes along single digit values only » Single digit value only

The query build must truncate this value. However, everything seems fine all the way through views_filters_populate_handler_filter.inc

I can get the value through the view by forcing it into the query (just for testing, because this is gross) with a hook_views_query_alter().

function MYMODULE_views_query_alter(&$view, &$query) {
  switch($view->name) {
    case 'MYVIEW' :
      $value = ($view->exposed_input['MYFILTER']) ? $view->exposed_input['MYFILTER'] : 9999; // my default
      $query->where[1]['args'][0] = $value;
      $query->where[1]['args'][1] = $value;
      break;
  }
}
doublejosh’s picture

Title: Single digit value only » Populate filter passes along single digit values only

improve title

hanoii’s picture

Title: Single digit value only » Populate filter passes along single digit values only

Nice catch and thanks for the report.

I think I might have fixed it, it's tricky because different filters has different forms of value objects.

Try git if your are impatient, will soon release a new version with this and another fix.

hanoii’s picture

Status: Active » Fixed
doublejosh’s picture

Awesome.
Glad my thoroughness made it solvable :)
I'll just leave my hack in place until you do the new release. Let me know if you do actually need a test.
Thanks.

hanoii’s picture

new release is out there.

test is very much welcome!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

typo