mutliple felds return duplicate rows in Views

biohabit - July 10, 2006 - 22:06
Project:Content Construction Kit (CCK)
Version:6.x-1.x-dev
Component:nodereference.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

Using the following:
Drupal 4.7.2
the June 25th CVS of the Views module
the June 12 CVS of the CCK module

I'm running into a problem where if I any of my CCK nodereference or userreference fields allow multiple values, you end up with the same node being displayed multiple times, one for every "multiple value" for the nodereference or userreference fields.

For example, I'm creating an inventory of services provided my my group, where samba is running on three hosts. The Title of the node is samba and there is a nodeference to the hostname inventory where I put in the names of the three hosts. The same problem occurs if a userference allows (and has) multiple values.

In an effort for samba to be listed only once, I enabled the filter of node:distinct and end up with samba not being listed at all. Any suggestions?

#1

merlinofchaos - September 7, 2006 - 03:57
Project:Views» Content Construction Kit (CCK)
Version:6.x-2.x-dev» 6.x-1.x-dev
Component:Code» nodereference.module

Unless CCK provides a manner of loading multiple fields into a single field (much like taxonomy: all terms works) there isn't much you can do here.

#2

hintbw - September 8, 2006 - 06:45

Just confirming the bug. I've found it seems to apply to any field (a text field in my case) that allows multiple values that have been defined. In my case it is a text field with football positions that have been defined as part of a "player bio" content type. By selecting multiple positions it causes the Node to show up multiple times instead of the position field showing multiple values. I find it hard to believe that this would be the intended behavior for these multiple select options (userreference, nodereference, or select lists).

I've attached a screenshot that demonstrates this behavior. Look at Drew Weimars in the screenshot, multiple instances of a single node because of that multiple position setting.

AttachmentSize
Picture 1_6.png 41.39 KB

#3

inforeto - September 11, 2006 - 22:16

+1 to this question

i'm having trouble to show multiple values in views, such as the taxonomy terms of a container assigned to a cck type.

perhaps theming the field? does the full array exist on $fields, $field or $data ?

or is it something that must be configured on the container or category?

#4

inforeto - September 11, 2006 - 23:22

I have checked the cck issues, but perhaps it is a views issue

Similar search results (first ten pages):

http://drupal.org/node/47774

#5

merlinofchaos - September 11, 2006 - 23:37

As I stated in update #1, CCK has deal with multiple fields differently, because of the way SQL. It is not a Views problem, though it may be a Views limitation.

#6

yched - September 29, 2006 - 13:49
Title:problems with CCK's nodereference & userreference and Views Distinict filter» mutliple felds return duplicate rows in Views

#7

yched - September 29, 2006 - 22:57

I'm working on a fix for this - I'm probably not the first one, but digging drupal.org on this subject revealed nothing.

What I came up with is based on GROUP BY's and GROUP_CONCAT's, it seems to work pretty well so far (not completely ironed out yet).

But...
GROUP_CONCAT means it requires MySQL 4.1 - No MySQL 3.x, no PgSQL. A solution for those db's might involve additional SELECTS (one per selected node), meaning possibly poor performance. Plus I'm not even sure I can branch the code for MySQL >= 4.1 and MySQL <= 4.1

So before I go on with this, I'd like to hear some advice, ideas, feedback :-)

#8

yched - October 8, 2006 - 21:52
Status:active» duplicate

I just submitted a patch for cck : http://drupal.org/node/88135
Marking this one as duplicate - please follow the discussion over there :-)

 
 

Drupal is a registered trademark of Dries Buytaert.