Hi Merlin, i am not sure if this is a bug or my understanding of whats expected
I have a view with exposed filter (cck field) and all options work except "Does not contain" , which returns unexpected results,
I have assumed that I can use this option to search for a string which is part of "myfield" and return all results not containing the string
I have a "myfield" containing image names for example "myimage1.jpg"
if i filter "myimage1.jpg" i return results as expected - anything not containing "myimage1.jpg"
if i filter "mage1.jpg" i return results as expected - anything not containing "mage1.jpg"
if i filter ".jpg" or "jpg" i get no results returned
$view = new view;
$view->name = 'admin_encylopedia_places';
$view->description = 'Admin only view of Places encyclopedia entries against Map';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Title',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_world_value' => array(
'id' => 'field_world_value',
'table' => 'node_data_field_world',
'field' => 'field_world_value',
),
'field_nation_value' => array(
'id' => 'field_nation_value',
'table' => 'node_data_field_nation',
'field' => 'field_nation_value',
),
'field_find_on_map_value' => array(
'id' => 'field_find_on_map_value',
'table' => 'node_data_field_find_on_map',
'field' => 'field_find_on_map_value',
),
'field_tag_value_1' => array(
'label' => 'Tag',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => 1,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_tag_value_1',
'table' => 'node_data_field_tag',
'field' => 'field_tag_value',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'title' => array(
'id' => 'title',
'table' => 'node',
'field' => 'title',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'encyclopedia' => 'encyclopedia',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'field_group_value' => array(
'operator' => 'or',
'value' => array(
'504' => '504',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_group_value',
'table' => 'node_data_field_group',
'field' => 'field_group_value',
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'field_world_value' => array(
'operator' => 'or',
'value' => array(
'593' => '593',
'797' => '797',
'594' => '594',
'798' => '798',
'679' => '679',
'801' => '801',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'field_world_value_op',
'identifier' => 'field_world_value',
'label' => 'Content: World - (field_world)',
'optional' => 0,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_world_value',
'table' => 'node_data_field_world',
'field' => 'field_world_value',
'relationship' => 'none',
'reduce_duplicates' => 0,
'override' => array(
'button' => 'Override',
),
),
'field_find_on_map_value' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'field_find_on_map_value_op',
'identifier' => 'field_find_on_map_value',
'label' => 'Content: Find on Map - (field_find_on_map)',
'optional' => 1,
'remember' => 1,
),
'case' => 0,
'id' => 'field_find_on_map_value',
'table' => 'node_data_field_find_on_map',
'field' => 'field_find_on_map_value',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'role',
'role' => array(
'3' => '3',
'5' => '5',
),
'perm' => '',
));
$handler->override_option('title', 'Admin Encyclopedia Places');
$handler->override_option('header_format', '3');
$handler->override_option('footer_format', '3');
$handler->override_option('empty_format', '3');
$handler->override_option('items_per_page', 200);
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'columns' => array(),
'default' => '',
'info' => array(),
'override' => FALSE,
'order' => 'asc',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'admin_encyc_places');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Query SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title,
node_data_field_world.field_world_value AS node_data_field_world_field_world_value,
node_data_field_world.nid AS node_data_field_world_nid,
node.type AS node_type,
node_data_field_find_on_map.field_nation_value AS node_data_field_find_on_map_field_nation_value,
node_data_field_find_on_map.nid AS node_data_field_find_on_map_nid,
node_data_field_find_on_map.field_find_on_map_value AS node_data_field_find_on_map_field_find_on_map_value,
node.vid AS node_vid
FROM node node
INNER JOIN content_field_group node_data_field_group ON node.vid = node_data_field_group.vid
INNER JOIN content_type_encyclopedia node_data_field_world ON node.vid = node_data_field_world.vid
LEFT JOIN content_type_encyclopedia node_data_field_find_on_map ON node.vid = node_data_field_find_on_map.vid
WHERE (node.type in ('encyclopedia')) AND (node_data_field_group.field_group_value = '504') AND (node_data_field_world.field_world_value IN ('593', '797', '594', '798', '679', '801')) AND ((node_data_field_find_on_map.field_find_on_map_value) NOT LIKE ('%.jpg%'))
ORDER BY node_title ASC
Comments
Comment #1
Anonymous (not verified) commentedAdditional info when i say no results returned. I have fields containing no data ie NULL
So is this a case of a field that is "NULL" does not equal a field not containing ".jpg"
and hence a case of lack of user understanding
Comment #2
merlinofchaos commentedIn SQL, NULL is never anything, even itself. For example, even this doesn't work:
...WHERE table.field = NULL;
Believe it or not, that won't work. The only way to get a comparison involving NULL to work is to use IS NULL or tricky coalesce stuff. And Views doesn't support anything like that from the UI unfortunately.
Comment #3
Anonymous (not verified) commentedHi Merlin, thanks for the clarification.
The way you explained it reminded me of the same issue i had in MS Access many years ago, and i couldnt do it then ( I blame the Grey Matter for not Remembering)
Comment #4
merlinofchaos commented