when one of them not blank then another means:
blank value['min'] = -inf.
blank value['max'] = +inf.
file: views_handler_filter_numeric.inc
line: 220
function op_between($field) {
if ($this->operator == 'between') {
if ($this->value['min']!="") $this->query->add_where($this->options['group'], "$field >= %d", $this->value['min']);
if ($this->value['max']!="") $this->query->add_where($this->options['group'], "$field <= %d", $this->value['max']);
}
else {
$this->query->add_where($this->options['group'], "$field <= %d OR $field >= %d", $this->value['min'], $this->value['max']);
}
}
Comments
Comment #1
deadman CreditAttribution: deadman commented+1 for this to be integrated
Comment #2
dawehnerThats a good feature, but why not use the is greater or is smaller then, this would do the same.
Comment #3
edemus CreditAttribution: edemus commentedIt simplifies form. Lets say i want to have both 'between' 'greater/less than' and i dont want to expose operator. This is pretty handy
Im using this one for mine purpose:
and for float type views_handler_filter_float.inc on line 10.
Emil
Comment #4
esmerel CreditAttribution: esmerel commentedThis would be better served if it were a real patch :)
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedThis needs someone to work on it.
Comment #6
dawehnerI'm wondering whether it makes sense to call another op_simple here, if the cases mentioned above should be used.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedYou mean, if one or the other is empty, pass through to op_simple? I think the operator would have to be mangled for that to really work.
Comment #8
dawehnerExactly.
Oh i see the problem. What about adding an optional value parameter to the op callbacks?
Comment #9
Wappie08 CreditAttribution: Wappie08 commentedHello, I also experience this in the 7.x version with (only) a "between" operator on a filter:
- when not entering a value all values are shown (right behavior)
- when only entering the max field the list is limited (right behavior)
- when only entering the min field no results are returned!
I'm filtering an integer field.
Greetings Wappie
Comment #10
Wappie08 CreditAttribution: Wappie08 commentedThis seems to be related to #856238: exposed filter of created date with "Is between" and optional returns empty results maybe. Feel free to put it 6.x again!
Comment #11
tamerzg CreditAttribution: tamerzg commentedFor D7 you can use change file: views_handler_filter_numeric.inc like this:
Comment #12
onelittleant CreditAttribution: onelittleant commented+1
Comment #13
Ctrl-E CreditAttribution: Ctrl-E commented+1
Comment #14
Mr. Red CreditAttribution: Mr. Red as a volunteer commentedWhen I use a filter with no maximum (['max']) value I don't see results in views. Is the problem still relevant?
Comment #15
MustangGB CreditAttribution: MustangGB commentedComment #16
MustangGB CreditAttribution: MustangGB commented