Drupal 7.22

Views 7.x-3.7

I have searched but cannot find anything like it.

I am showing a list of nodes (of a certain type) and their addresses. Location CCK field holds addresses and displays fine on node (and in map on node).

Suddenly, when I added the address field extra rows appeared, repeating a node title and NID but pulling in a random other address. Both rows in the view link to the same node (same nid) with the correct address. I searched through the database for a strange street address and found it in an unrelated Ubercart order by a different user than the node author (!!)

If I remove the location field from the view, all goes back to normal, which is why I'm posting here rather than in the views issues.

Attached is a screenshot of my (simplified) testing views showing the duplicates that appear, not every node shows a duplicate.

Here is the view code if that helps: THANKS!
$view = new view();
$view->name = 'neighborhood_testing';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test neighborhood listings';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'neighborhood listings';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['query']['options']['pure_distinct'] = TRUE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = 'NID';
/* Field: Location: Street */
$handler->display->display_options['fields']['street']['id'] = 'street';
$handler->display->display_options['fields']['street']['table'] = 'location';
$handler->display->display_options['fields']['street']['field'] = 'street';
$handler->display->display_options['fields']['street']['label'] = '';
$handler->display->display_options['fields']['street']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['street']['style'] = 'street';
/* Sort criterion: Field: last name (field_last) */
$handler->display->display_options['sorts']['field_last_value']['id'] = 'field_last_value';
$handler->display->display_options['sorts']['field_last_value']['table'] = 'field_data_field_last';
$handler->display->display_options['sorts']['field_last_value']['field'] = 'field_last_value';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'postprofile' => 'postprofile',
'partner_profile' => 'partner_profile',
);
$handler->display->display_options['filters']['type']['group'] = 1;

Files: 

Comments

stellarvisions’s picture

StatusFileSize
new19.63 KB

MORE INFO -- if, when adding the field to the view I use Content: studio address, rather than Location: Address it works fine.

NOTE: if I use both, I get the duplicates with the bad data in only one of the fields. The attached capture shows a display in the view for one node, showing the location field twice (once as Content: studio address, again as Location:Address -- should be the same data but it is not. 2nd address is unrelated).

So, using only the Content: studio address fixed it for the text listing. So I hoped that would work for map nodes, but no, a dupe pin shows up in the wrong location.

jessia’s picture

Version:7.x-3.0-rc1» 7.x-3.0-rc2

I've got the same problem.
http://onestaratatime.org/starparks/list

Some of the parks are showing up twice in the list, once with the correct country and one with another. The listings themselves have only a single location, and I'm having trouble determining where the extra location is stored or coming from.

For example:
Bear Rock Meadow of Inwood Hill Park is listed twice, once under country: United States, and again under country: Sudan. When I look at the listing on its own page, I only see the USA address. When I edit the listing, that's all I see. It's only when I list it using Views that I have this problem, and it's not a problem everywhere—many of the listings display just fine.

Any ideas for what may be causing this or how to remove the duplicates?

jessia’s picture

Category:support» bug
jessia’s picture

Further update: as with the OP, when I set the view field to Content: Location, it works. The duplicate entry is only when I select Location: Country. However, the idea is to have a table that shows the country and the distance from the user, as on http://onestaratatime.org/starparks/all

As far as I know, I can't get that kind of granular control using the Content: Location field. Any suggestions for how to obtain this functionality or how to work around this issue? I've tried a few different things with views, such as aggregating location fields for the listing, so it would show only one location... but it wasn't always the correct one!

jessia’s picture

Component:Code» Location_views

Quite frustrating. I love Location and all it does! I've been using it for years, mostly without incident. I've tried most of the other location & mapping modules and have found this one to be the best, but I'm a little at a loss as to how to proceed or how to fix this problem. Events in the USA have map markers in Switzerland (and where they should be). Any insight into what's going on?

stellarvisions’s picture

Seconding the frustration,
We have tried every possible combination and cannot remedy this situation. We don't know what else we can do. Can anyone give us a heads up on what's going on or what we should try to provide the maintainers with more helpful information?

bestinc’s picture

I have run into a problem as well with locations. I am not sure if it pertains to your issue but it could be related. I am using a locations field in a profiles 2 profile and having user's select just countries. I am running it through a views, but I am getting weird locations plotted, not having to deal with the original selections.
EX. http://i.imgur.com/HrPvlns.png?1
Barbados is showing up in Germany. What I have discovered is locations is is skipping the country info and geocoding the province information.
Let me explain, the country code for Barbados is "BB", it is showing up in Germany though. I found that it is showing the point in the Brandenburg Province/State of Germany. The code for Brandenburg is "BB". Provinces are effectively overriding countries, at least in my case.

Hope that can help

kasiawaka’s picture

Hello,
We would like to confirm the issue. The location fields in Views cause incorrect location entries to be displayed if there is more then one content type or user that is using Location fields.

Here is our situation: we have Events content type that uses Location to store address details of events but also have User location field that keep track of user address.

We have a view that displays a list of all events. In that view, when we use fields like Location: Country or Location: Province (or any that starts with Location:), we are getting duplicate rows for each event - one row with event displayed with own location and another row with event displayed with user address, where user id matches event node id.

There is a workaround, when we use Content: Location field instead, the duplicates are gone.

To help troubleshoot, here is an export of both views (not working and working) and associated queries.

1. The view that displays duplicates when we use Location: Country field.

VIEW
$view = new view();
$view->name = 'testing_event_location';
$view->description = '(FFS) Calendar display of events from all organizations';
$view->tag = 'Calendar';
$view->base_table = 'node';
$view->human_name = 'Testing event location';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Events';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['link_display'] = 'page_1';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['date_id'] = 'month';
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['row_plugin'] = 'calendar_entity';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'event' => 'event',
);

/* Display: Events */
$handler = $view->new_display('block', 'Events', 'block_2');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['display_description'] = 'Events list with address';
$handler->display->display_options['defaults']['use_more'] = FALSE;
$handler->display->display_options['use_more'] = TRUE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'title' => 'title',
'field_event_date' => 'field_event_date',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'title' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'field_event_date' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = FALSE;
/* Field: Location: Country */
$handler->display->display_options['fields']['country']['id'] = 'country';
$handler->display->display_options['fields']['country']['table'] = 'location';
$handler->display->display_options['fields']['country']['field'] = 'country';
$handler->display->display_options['defaults']['sorts'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'event' => 'event',
);

QUERY:
SELECT node.title AS node_title, node.nid AS nid, location.country AS location_country
FROM
{node} node
LEFT JOIN {location_instance} location_instance ON node.vid = location_instance.vid
LEFT JOIN {location} location ON location_instance.lid = location.lid
WHERE (( (node.status = '1') )AND(( (node.type IN ('event')) )))
LIMIT 25 OFFSET 0

2. Correct view where we use Content: Location field
$view = new view();
$view->name = 'testing_event_location';
$view->description = '(FFS) Calendar display of events from all organizations';
$view->tag = 'Calendar';
$view->base_table = 'node';
$view->human_name = 'Testing event location';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Events';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['link_display'] = 'page_1';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'date_views_pager';
$handler->display->display_options['pager']['options']['date_id'] = 'month';
$handler->display->display_options['style_plugin'] = 'calendar_style';
$handler->display->display_options['style_options']['name_size'] = '3';
$handler->display->display_options['style_options']['with_weekno'] = '0';
$handler->display->display_options['style_options']['multiday_theme'] = '1';
$handler->display->display_options['style_options']['theme_style'] = '1';
$handler->display->display_options['style_options']['max_items'] = '0';
$handler->display->display_options['row_plugin'] = 'calendar_entity';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'event' => 'event',
);

/* Display: Events */
$handler = $view->new_display('block', 'Events', 'block_2');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['display_description'] = 'Events list with address';
$handler->display->display_options['defaults']['use_more'] = FALSE;
$handler->display->display_options['use_more'] = TRUE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'title' => 'title',
'field_event_date' => 'field_event_date',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'title' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'field_event_date' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = FALSE;
/* Field: Content: Event Location */
$handler->display->display_options['fields']['field_event_location']['id'] = 'field_event_location';
$handler->display->display_options['fields']['field_event_location']['table'] = 'field_data_field_event_location';
$handler->display->display_options['fields']['field_event_location']['field'] = 'field_event_location';
$handler->display->display_options['defaults']['sorts'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'event' => 'event',
);

QUERY:
SELECT node.title AS node_title, node.nid AS nid, 'node' AS field_data_field_event_location_node_entity_type
FROM
{node} node
WHERE (( (node.status = '1') )AND(( (node.type IN ('event')) )))
LIMIT 25 OFFSET 0

kasiawaka’s picture

deleted post, posted twice

stellarvisions’s picture

This solved 99% of my issues:
https://drupal.org/project/views_distinct

A few outliers, while not duplicated, are appearing in the wrong spot still.

dandaman’s picture

I seem to be experiencing this issue on our sites as well.

I took a look directly in the database and did find something that seems to explain this. I'm not exactly sure about all the details, but here's what I've observed so far.

In the location_instance table, there are some rows that have the same nid, vid, and, in some cases, even the same lid. What does seem to vary is the genid field. Usually, when there's duplicates, one has the genid blank and another has something filled into the genid.

I found an item with only one instance per nid/vid that had a blank genid, and when I resaved the node, a new row was created with a genid populated. So now there are two instances for this node. And that would probably make doubles in Views.

So if you comb through this table and remove the duplicates, then it should stop the view from duplicating. Maybe I'll figure out some SQL to automate this process too, if I find time to dig into it further.

Hope this helps!

dandaman’s picture

I may be wrong, but I think in our case it might not be a problem with Location directly, but maybe also with how we imported most of our nodes via Feeds. Anyone else having this problem that imported their data using Feeds?

dandaman’s picture

Issue summary:View changes

corrected typo in original post

incrn8’s picture

Version:7.x-3.0-rc2» 7.x-3.6

I realize this is old, but the issue I'm seeing is that the location field on USERS is causing the duplication on the EVENT node listings. Users are saved wiht a nid=0, and the vid and uid are the same. The vid should be 0 in my opinion, because if the uid actually matches a node's vid, you get the duplicate listing. I don't why this happens, though, but I'm guessing its something in location module. I cannot see the Content option for the field in Views, only the Location option, so the fix mentioned above doesn't work. I'll keep digging.

incrn8’s picture

Status:Active» Closed (duplicate)

It looks like this is actually fixed in 3.6 now. See https://www.drupal.org/node/1962852. So I'm going to mark this as a duplicate of that issue. Simply setting all the vid values to zero for the user locations fixed the existing entries, by the way.