No matter how I sort my book nodes (book weight, title etc.), multiple instances of the same node appear if files happen to be attached.

If one node has 5 attached files, 5 instances are displayed in the custom Views page.

I am using the basic upload module, NOT Filemanager.

Is there a patch to prevent the same node to be displayed twice or more?

Comments

merlinofchaos’s picture

Have you tried the distinct filter? Are you showing fields or filters from the files table?

marcoBauli’s picture

Also, with what attachment module did this happen exactly? (upload, upload_image, image_attach, imagefield,...)

I encountered the same problem listing CCK nodes with multiple images attached to them with imagefield.module (filed a related issue on that mod's project page here on #3)

mediameriquat’s picture

OK, this time I tried with a more complex post:

First, I publish an image type node (I have the Image module installed, I guess it is the upload_image ??) and it generates a thumbnail, so that 2 files are "attached" to the node.

Then I enter some description text and attach a PDF file to the node, using the basic upload module (the one that comes with the core installation).

Total = 3 files attached, and 3 instances of the same node are listed in the page generated by the Views module. This looks like a bug.

I did not specify anything re: files and filters.

mediameriquat’s picture

Sorry, I actually have one filter that shows all children of a specific book page.

The fields displayed are Node:Title, Node:Body, and File:Name (if any).

Nodes are sorted by Node title.

IMPORTANT: if I suppress the File:Name field, I don't have this problem anymore. So for now I'll just find another way of letting users know there are some files attached (Hey dude, 3 files to download here! in the first line of body text.)

I've been using the SPIP engine a few times, and I took for granted the fact that a same node won't be displayed twice. They might have some interesting PHP code over there.

xamox’s picture

I am having the same problem, whether I am using list view or table view.

eaton’s picture

At present, the 'file name' field isn't able to collapse ALL the files on a node into a single entry. Because of that, adding the 'file: name' field will cause an entry for EACH file. If it's more important to have one line item ofr each node, add the 'distinct' filter.

xamox’s picture

I am not even using the file name field. I am using the "node:Author Name" field with "node:distinct" as a filter and yet I am still getting it displaying multiples. What it displays is this:

admin
admin
admin
admin
xamox
admin

I am logged in as admin, and xamox is a standard user on the install. Not quite sure why this is happening. Doesn't matter for what node type I add either still displaying multiples.

m3avrck’s picture

I'm encountering this same issue but with multiple node references.

I've created a view that has shows a list of nodes, each of these nodes has *multiple* nodereferences. For each node reference the item shows up in the view, with each item showing only *1* reference. It'll show each item, with each nodereference.

So if I have a node with node references A, B, C and I want to show a view of all nodes, in my view, it's going to list my node with A, same node with B, and same node with C.

It does not seem to just show the node with A, B, and C

Sounds like the same problem as files.

m3avrck’s picture

Also, as mentioned, if I turn off my nodereference field as a displayed field, only one node shows up, as it should.

Sounds like the query logic that builds the list of nodes with references is wrong... it shows each node with each reference (or file), instead of, in these cases, looping through the node and all of it's references and aggregating them together.

xamox’s picture

Yeah mine fuctions the same way(multiples of nodes), only when I use node references such as "Node:Title", "Node:Type", etc. But if I used something else it displays how it should

merlinofchaos’s picture

Yup. This is an issue with SQL more than it is with Views.

Let's say I have two tables.

NODE
nid title
1 'Hello there, here are some files for you'

FILES
nid file
1 'foo.zip'
1 'bar.zip'

Because Views wants to get every node in a single record, it uses your basic JOIN, which WILL result in:

1 'Hello...' 'foo.zip'
1 'Hello...' 'bar.zip'

With the current setup, that's what you can get. Possibly I can add an 'all files' field like the taxonomy: all terms. Not sure. That creates an extra query per record.

m3avrck’s picture

Hmmm, in terms of performance, this would only affect people showing listing of files. Seems to me that an extra query would be worth the hit, consolidating the view so it makes more sense.

merlinofchaos’s picture

Want to write a patch? =)

m3avrck’s picture

*runs*

Not familar enough with Views to do that--yet. I wouldn't hold your breath waiting on me though :-p

xamox’s picture

Sorry, my above statement was wrong. I didn't really understand how to use views when I first started using it and this is no longer a problem for me.

merlinofchaos’s picture

m3avrck: Here's a start

'all_files' => array(
'name' => t('File: All Attached Files'),
'notafield' => true,
'handler' => 'views_handler_file_all_files',
'sortable' => false,
'help' => t('Display all attached files as one field),
),

Then the above handler runs a query to determine the files that are attached. See, easy!

merlinofchaos’s picture

Status: Active » Fixed

This feature will appear in Views 1.1

Anonymous’s picture

Status: Fixed » Closed (fixed)
joeshirley@drupal.org’s picture

Title: Many instances of the same node, if files attached » Many instances of the same node, if multiple vocabularies selected as filter
Version: 4.7.x-1.x-dev » 5.x-1.2-beta1
Category: support » bug

I have a standard list view with half a dozen filters. One is Taxonomy: Vocabulary Name. When I choose operator "Is One Of" and select multiple vocabularies, my list view displays multiple nodes - as many multiples as the node has vocabulary terms. Example: if three vocabularies are chosen in the filter, a node with terms in all three vocabularies will display three times while a node with only two terms selected will show up only twice. (Fortunately, for now I am able to set up my vocabularies so that I can choose just one for my filter and get the results I'm after.)

I have no coding experience, so will not be able to help troubleshoot and fix. But thought you should hear about it.

Here's the export:

$view = new stdClass();   $view->name = 'mapview';   $view->description = 'View maps every which way';   $view->access = array ( );   $view->view_args_php = '';   $view->page = TRUE;   $view->page_title = 'Browse Multiple Maps';   $view->page_header = '';   $view->page_header_format = '3';   $view->page_footer = '';   $view->page_footer_format = '3';   $view->page_empty = '';   $view->page_empty_format = '3';   $view->page_type = 'teaser';   $view->url = 'browsemaps';   $view->use_pager = TRUE;   $view->nodes_per_page = '20';   $view->sort = array (     array (       'tablename' => 'term_data',       'field' => 'weight',       'sortorder' => 'ASC',       'options' => '',     ),     array (       'tablename' => 'book',       'field' => 'weight',       'sortorder' => 'ASC',       'options' => '',     ),   );   $view->argument = array (   );   $view->field = array (     array (       'tablename' => 'node',       'field' => 'title',       'label' => '',       'handler' => 'views_handler_field_nodelink',       'defaultsort' => 'ASC',       'options' => 'link',     ),     array (       'tablename' => 'node',       'field' => 'body',       'label' => '',       'handler' => 'views_handler_field_teaser',     ),   );   $view->filter = array (     array (       'tablename' => 'node',       'field' => 'status',       'operator' => '=',       'options' => '',       'value' => '1',     ),     array (       'tablename' => 'term_data',       'field' => 'vid',       'operator' => 'OR',       'options' => '',       'value' => array (   0 => '5',   1 => '13',   2 => '8', ),     ),     array (       'tablename' => 'node',       'field' => 'distinct',       'operator' => '=',       'options' => '',       'value' => array ( ),     ),     array (       'tablename' => 'term_node_11',       'field' => 'tid',       'operator' => 'OR',       'options' => '',       'value' => array ( ),     ),     array (       'tablename' => 'term_node_5',       'field' => 'tid',       'operator' => 'OR',       'options' => '',       'value' => array ( ),     ),     array (       'tablename' => 'term_node_13',       'field' => 'tid',       'operator' => 'OR',       'options' => '',       'value' => array ( ),     ),     array (       'tablename' => 'term_node_8',       'field' => 'tid',       'operator' => 'OR',       'options' => '',       'value' => array (   0 => '79', ),     ),   );   $view->exposed_filter = array (     array (       'tablename' => 'term_node_11',       'field' => 'tid',       'label' => 'Whose Maps?',       'optional' => '1',       'is_default' => '0',       'operator' => '1',       'single' => '0',     ),     array (       'tablename' => 'term_node_5',       'field' => 'tid',       'label' => 'What Level?',       'optional' => '1',       'is_default' => '0',       'operator' => '1',       'single' => '0',     ),     array (       'tablename' => 'term_node_13',       'field' => 'tid',       'label' => 'Which Parts?',       'optional' => '1',       'is_default' => '0',       'operator' => '1',       'single' => '0',     ),     array (       'tablename' => 'term_node_8',       'field' => 'tid',       'label' => 'What Stage?',       'optional' => '1',       'is_default' => '0',       'operator' => '1',       'single' => '0',     ),   );   $view->requires = array(term_data, book, node, term_node_11, term_node_5, term_node_13, term_node_8);   $views[$view->name] = $view;

By the way, I absolutely love the module - am using it for the first time.

joeshirley@drupal.org’s picture

One more note: I did try the Node: Distinct filter to no avail.

merlinofchaos’s picture

Title: Many instances of the same node, if multiple vocabularies selected as filter » Many instances of the same node, if files attached
Version: 5.x-1.2-beta1 » 4.7.x-1.x-dev

Please don't take over semi-related issues. This one was about files, yours is about taxonomy. The behavior is similar but this is a different issue.

joeshirley’s picture

My apologies. This is my first attempt submitting bug reports etc, so would like to try to contribute. Thanks for your input. Should I submit a new issue?

merlinofchaos’s picture

Yes, please do so. The issue is valid, I think, though may be somewhat difficult to fix properly.