I have a view that takes a NID as an argument, then pulls in other nodes through a relationship. Now, when I want to display a formatted address ( (Locations) Content AnP: Address Default (User/site render) ) the query becomes invalid. I've seen it happen too when I add a 'Map links' field. Other fields seem to work fine.
Am I doing something wrong? Any help would be appreciated.
The error views gives me is:
user warning: Unknown column 'node_data_field_location_address_a.vid' in 'where clause' query: SELECT node.nid AS nid, node_node_data_field_organisation_location_node_data_field_location_address_p.vid AS node_node_data_field_organisation_location_node_data_field_location_address_p_vid, node_node_data_field_organisation_location_node_data_field_location_address_a.country AS node_node_data_field_organisation_location_node_data_field_location_address_a_country, node_node_data_field_organisation_location_node_data_field_location_address_a.adminarea AS node_node_data_field_organisation_location_node_data_field_location_address_a_adminarea, node_node_data_field_organisation_location_node_data_field_location_address_a.subadminarea AS node_node_data_field_organisation_location_node_data_field_location_address_a_subadminarea, node_node_data_field_organisation_location_node_data_field_location_address_a.locality AS node_node_data_field_organisation_location_node_data_field_location_address_a_locality, node_node_data_field_organisation_location_node_data_field_location_address_a.deplocality AS node_node_data_field_organisation_location_node_data_field_location_address_a_deplocality, node_node_data_field_organisation_location_node_data_field_location_address_a.postalcode AS node_node_data_field_organisation_location_node_data_field_location_address_a_postalcode, node_node_data_field_organisation_location_node_data_field_location_address_a.thoroughfare AS node_node_data_field_organisation_location_node_data_field_location_address_a_thoroughfare, node_node_data_field_organisation_location_node_data_field_location_address_a.privacy AS node_node_data_field_organisation_location_node_data_field_location_address_a_privacy, node_node_data_field_organisation_location_node_data_field_location_address_a.search AS node_node_data_field_organisation_location_node_data_field_location_address_a_search, node_node_data_field_organisation_location_node_data_field_location_address_p.map_type AS node_node_data_field_organisation_location_node_data_field_location_address_p_map_type, node_node_data_field_organisation_location_node_data_field_location_address_p.latitude AS node_node_data_field_organisation_location_node_data_field_location_address_p_latitude, node_node_data_field_organisation_location_node_data_field_location_address_p.longitude AS node_node_data_field_organisation_location_node_data_field_location_address_p_longitude, node_node_data_field_organisation_location_node_data_field_location_address_p.elevation AS node_node_data_field_organisation_location_node_data_field_location_address_p_elevation, node_node_data_field_organisation_location_node_data_field_location_address_p.x AS node_node_data_field_organisation_location_node_data_field_location_address_p_x, node_node_data_field_organisation_location_node_data_field_location_address_p.y AS node_node_data_field_organisation_location_node_data_field_location_address_p_y, node_node_data_field_organisation_location_node_data_field_location_address_p.z AS node_node_data_field_organisation_location_node_data_field_location_address_p_z, node_node_data_field_organisation_location_node_data_field_location_address_p.privacy AS node_node_data_field_organisation_location_node_data_field_location_address_p_privacy, node_node_data_field_organisation_location_node_data_field_location_address_p.bounds AS node_node_data_field_organisation_location_node_data_field_location_address_p_bounds, node_node_data_field_organisation_location_node_data_field_location_address_p.pov AS node_node_data_field_organisation_location_node_data_field_location_address_p_pov, node_node_data_field_organisation_location_node_data_field_location_address_p.search AS node_node_data_field_organisation_location_node_data_field_location_address_p_search, node_node_data_field_organisation_location.nid AS node_node_data_field_organisation_location_nid, node_node_data_field_organisation_location.vid AS node_node_data_field_organisation_location_vid, node_node_data_field_organisation_location.uid AS node_node_data_field_organisation_location_uid, node_node_data_field_organisation_location.type AS node_node_data_field_organisation_location_type FROM node node LEFT JOIN content_field_organisation_location node_data_field_organisation_location ON node.vid = node_data_field_organisation_location.vid LEFT JOIN node node_node_data_field_organisation_location ON node_data_field_organisation_location.field_organisation_location_nid = node_node_data_field_organisation_location.nid LEFT JOIN gmaps_content_point node_node_data_field_organisation_location_node_data_field_location_address_p ON node_node_data_field_organisation_location.vid = node_node_data_field_organisation_location_node_data_field_location_address_p.vid AND (node_node_data_field_organisation_location_node_data_field_location_address_p.field_name = 'field_location_address' AND node_node_data_field_organisation_location_node_data_field_location_address_p.delta = 0) LEFT JOIN gmaps_content_address node_node_data_field_organisation_location_node_data_field_location_address_a ON node_node_data_field_organisation_location.vid = node_node_data_field_organisation_location_node_data_field_location_address_a.vid AND (node_node_data_field_organisation_location_node_data_field_location_address_a.field_name = 'field_location_address' AND node_node_data_field_organisation_location_node_data_field_location_address_a.delta = 0) WHERE (node.nid = 2) AND ((node_node_data_field_organisation_location_node_data_field_location_address_p.vid IS NULL OR (node_node_data_field_organisation_location_node_data_field_location_address_p.vid = node_data_field_location_address_a.vid AND node_node_data_field_organisation_location_node_data_field_location_address_p.field_name = node_data_field_location_address_a.field_name AND node_node_data_field_organisation_location_node_data_field_location_address_p.delta = node_data_field_location_address_a.delta AND node_node_data_field_organisation_location_node_data_field_location_address_p.field_name = 'field_location_address' AND node_node_data_field_organisation_location_node_data_field_location_address_p.delta = 0))) in /usr/local/www/drupal-6.16/sites/all/modules/views/includes/view.inc on line 769.
And the view itself:
$view = new view;
$view->name = 'organisation_locations_1';
$view->description = 'Organisation Locations';
$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('relationships', array(
'field_organisation_location_nid' => array(
'label' => 'Locations',
'required' => 0,
'delta' => '-1',
'id' => 'field_organisation_location_nid',
'table' => 'node_data_field_organisation_location',
'field' => 'field_organisation_location_nid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'field_location_address' => array(
'label' => 'Address',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'gmaps' => array(
'formatter' => array(
'show' => 'anp',
'address' => array(
'user_settings' => 1,
'country' => 'name',
'state' => '',
'flag' => '',
'taxonomy_links' => 0,
),
'point' => array(
'user_settings' => 1,
'format' => 'dd',
'elevation' => '1',
'dd_prec' => '6',
'dms_prec' => '0',
'cart_prec' => '2',
'elevation_prec' => '0',
),
'map' => array(
'map' => '5',
'static_map' => '1',
'cache' => 0,
'cache_expires' => '',
'content' => 'default',
),
'map_links' => array(
'google_find' => 1,
'google_directions_from' => 0,
'google_directions_to' => 1,
'yahoo_find' => 0,
'yahoo_directions_from' => 0,
'yahoo_directions_to' => 0,
'mapquest_find' => 0,
'mapquest_directions_from' => 0,
'mapquest_directions_to' => 0,
),
),
),
'exclude' => 0,
'id' => 'field_location_address',
'table' => 'node_data_field_location_address_p',
'field' => 'field_location_address',
'relationship' => 'field_organisation_location_nid',
),
));
$handler->override_option('arguments', array(
'nid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'node',
'default_argument' => '',
'validate_type' => 'node',
'validate_fail' => 'not found',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'location' => 0,
'organisation' => 0,
'page' => 0,
'profile' => 0,
),
'validate_argument_node_access' => 1,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Locations');
$handler->override_option('items_per_page', 0);
Comments
Comment #1
xmarket CreditAttribution: xmarket commentedPlease, upgrade to the latest dev (it contains lots of bug fixes related to filters and arguments) and reopen this issue if it still exists.
Comment #3
thommyboy CreditAttribution: thommyboy commentedI still have this problem with the newest dev. It only occurs when using a "content anp" field of a node linked into the view by a relationship. Using a "content point" field the same way works fine. Unfortunately I need anp to access the country. Any help appreciated!
Comment #4
thommyboy CreditAttribution: thommyboy commentedno solution for this?
Comment #5
thommyboy CreditAttribution: thommyboy commentedsome more information i found out:
a) the problem only occurs when you do include the "whole" anp field into a view, everything is fine when including a "sub field" like "longitude"
b) problem is only there when the anp field is linked into the view by a relationship
in my case i need access to the "bounds" fields- but there is no field handler for those. so i need to select the "whole" anp field to access the bounds from inside my views-template. is there any other solution for that?
any hint appreciated!
Comment #6
thommyboy CreditAttribution: thommyboy commentedComment #7
thommyboy CreditAttribution: thommyboy commentedok- in the WHERE clause the right-side part is missing the relationship. In tomasvv's Code above e.g. the line
node_node_data_field_organisation_location_node_data_field_location_address_p.vid = node_data_field_location_address_a.vid
needs to be
node_node_data_field_organisation_location_node_data_field_location_address_p.vid = node_node_data_field_organisation_location_node_data_field_location_address_a.vid
Unfortunately I'm not fit enough in module development to change that...
Comment #8
thommyboy CreditAttribution: thommyboy commentedsolved the problem for me by changing line #255 of gmaps_content_handler_field.inc
from
$a = $this->definition['address_table_alias'];
to
$a = $this->query->ensure_table($this->definition['address_table_alias'], $this->relationship);
maybe someone with deeper insight could check that?