Hello all,
I'm trying to filter out rows that contain a value outside a certain range. My logged in user has a field that says 'taller than' and another field that says 'smaller than'. My view should display only those user that have a height falling inside this range. Simple enough, and I did manage to get all the right results in an output field with this code:
<?php
global $user;
$user_fields = user_load($user->uid);
$taller = $user_fields->field_tallerthan['und']['0']['value'];
$smaller = $user_fields->field_smallerthan['und']['0']['value'];
$height = $data->_field_data['uid']['entity']->field_height['und'][0]['value'];
print "height = " . $height . "<br />";
print $taller . "<br />" . $smaller . "<br />";
echo ($height <= $taller);
?>
This outputs the values per row of the range that is needed, plus the height value of the user, and '1' or '0' as a result of the validation.
If I paste this test code in the filter area however (adapting it to output just true or false), it doesn't work at all. I get nothing at all, or I get all values in some circumstances, I can't seem to find the logic, and I don't know what's happening behind the screens either. Is there a way to find out, or does anyone have a hint how to find a solution for this seemingly simple problem?
Thanks in advance!
BP
Comments
Comment #1
johnvI archieved this with the patch in #1140896: Variable $row does not contain correct values ($data->_field_data does)