Not sure if this is related to this issue or not: http://drupal.org/node/345571

I created a simple display in Views to show several different vocabularies (content taxonomy fields) from one node.

If I have only one multivalue field for a content taxonomy vocabulary it's ok, but if I add another multivalue content taxonomy field, Views interleaves the two in the (unformatted) display list and duplicates some terms and omits others from both vocabularies. The two fields/vocabularies are separate and do not have any common terms. I tried different output formats like table, and grid and got the same results.

Here's the output with just two fields, LIving Room Amenities, and Kitchen Amenities:

Living Room Amenities: Aircon
Kitchen Amenities: Electric Kettle
Living Room Amenities: Aircon
Kitchen Amenities: Flatware
Living Room Amenities: Aircon
Kitchen Amenities: Refrigerator
Living Room Amenities: Aircon
Kitchen Amenities: Sink
Living Room Amenities: Balcony
Kitchen Amenities: Electric Kettle
Living Room Amenities: Balcony
Kitchen Amenities: Flatware
Living Room Amenities: Balcony
Kitchen Amenities: Refrigerator
Living Room Amenities: Balcony
Kitchen Amenities: Sink
Living Room Amenities: Seaview
Kitchen Amenities: Electric Kettle
Living Room Amenities: Seaview
Kitchen Amenities: Flatware

It should look something more like what the straight node output looks like (depending on the theme), as shown below (ignore all the leading periods - I added these because extra spaces get deleted here):

Kitchen Amenities: Electric Kettle
...............................Flatware
...............................Refrigerator
...............................Sink

Living Room Amenities: Aircon
......................................Balcony
......................................Seaview
......................................Cable TV
......................................Regular TV
......................................Ceiling Fan
......................................Telephone
----------------------------------------------------------

I made a simple test view (attached) with the same fields and output as above, that produced this query:

SELECT node.nid AS nid,
   node_data_field_kitchen_amenities.field_kitchen_amenities_value AS node_data_field_kitchen_amenities_field_kitchen_amenities_value,
   node_data_field_kitchen_amenities.delta AS node_data_field_kitchen_amenities_delta,
   node.type AS node_type,
   node.vid AS node_vid,
   node_data_field_living_room_amenities.field_living_room_amenities_value AS node_data_field_living_room_amenities_field_living_room_amenities_value,
   node_data_field_living_room_amenities.delta AS node_data_field_living_room_amenities_delta
 FROM node node 
 LEFT JOIN content_field_kitchen_amenities node_data_field_kitchen_amenities ON node.vid = node_data_field_kitchen_amenities.vid
 LEFT JOIN content_field_living_room_amenities node_data_field_living_room_amenities ON node.vid = node_data_field_living_room_amenities.vid
 WHERE node.nid = 5432

----------------------------------------------

I ran into this issue again trying to use the Dynamic Display Block module to show multiple images from one image filefield in one node concatenated with another multiple image field from another node, using a relationship. If just one field is used, ddblock shows those images just fine. If I add the 2nd field, ddblock shows duplicate images from the first field and none from the 2nd. Seems like it's the same issue.

A secondary concern:

Even with just one content taxonomy field, Views displays the Vocabulary Title for each term in the list which does not occur in the straight node output which displays the title once for all the terms in a vocabulary, as in the example above. This is not a big problem as I style the output explicitly using the variables for value and label.

CommentFileSizeAuthor
#1 ct_test_2m.txt3.74 KBdruplicate
ct_test.txt3.23 KBdruplicate

Comments

druplicate’s picture

StatusFileSize
new3.74 KB

Reading the noted related issue some more, I tried using the "Taxonomy: All Terms" field and got mixed results.

I added two fields, one for Living Room and one for Kitchen.

Using an unordered list, I was able to get the correct output for the Living Room, but the Kitchen field was empty. In fact if I add any other field this way it's also empty:
------------------------------
Living Room:

* Aircon
* Balcony
* Seaview
* Cable TV
* Regular TV
* Ceiling Fan
* Telephone

Kitchen: empty list
-----------------------------

Including only the Kitchen field still shows it empty. Only the Living Room vocabulary shows up, in any combination.

Clearly Views knows about the Kitchen data as it can display it separately as a Content Taxonomy field, by itself. It seems rather odd that only one vocabulary out of many in this node show up.

The query run with the two fields is surprisingly spare:

SELECT node.nid AS nid,
   node.vid AS node_vid
 FROM node node 
 WHERE node.nid = 5432

This view is attached.

druplicate’s picture

Not the most intuitive result but going back to using content taxonomy fields and checking "Group Multiple Values" solves the problem:

Kitchen Amenities:
Electric Kettle
Flatware
Refrigerator
Living Room Amenities:
Aircon
Balcony
Seaview
Cable TV
Regular TV
Ceiling Fan
Telephone

However it doesn't solve the missing data issue when using "Taxonomy: All Terms" fields.

This is a confusing issue and this statement next to the check box doesn't help much:

"If unchecked, each item in the field will create a new row, which may appear to cause duplicates. This setting is not compatible with click-sorting in table displays."

Looking for a better explanation of this issue in Advanced Help shows this: "For the most part, the field settings should be self explanatory." Couldn't find anything on Drupal.org under Views2 documentation, or anywhere else.

Seems to me that the best kind of documentation is many, many use cases, like mine, but this is obviously not the best place to put it, which begs for a wiki. I've mentioned this elsewhere but would like to suggest making links in the Advanced Help sections to such a wiki on Drupal.org.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

To be honest, I don't really understand what the content taxonomy module does, so I recommend you ask questions/file bug reports about its behavior in its queue.

druplicate’s picture

I did post this originally at ConTax, but didn't get a reply after a few days and then thinking about it after seeing the related issue, thought this would be a more appropriate venue.

That and I noticed a dearth of activity with some issues not responded to for months.

I'll go back there and tack on the extra bit about the missing data in the "Taxonomy: All Terms" thing. It's not such a big issue now for me since I've solved it.

This is where I filed it: http://drupal.org/node/584114

Unfortunately this solution breaks the Dynamic Display Block module when trying to do what I mentioned before with concatenating images from two different nodes via a relationship. Ddblock requires you to uncheck the "Group Multiple Values" box, as noted here: http://ddblock.myalbums.biz/node/888.

Here is a relevant discussion about this: http://ddblock.myalbums.biz/node/1721 with more to be added about this issue in particular, soon.

merlinofchaos’s picture

The 'group multiple values' concept is a CCK thing, and it's very important, because simply joining a table that has a many to one relationship (i.e, if you've got a field that can have multiple values) causes records to appear duplicated. That is a core concept of how SQL works. When you check this option, what it actually does is perform a second query to get all of the related values, so that you won't get duplicates. I know nothing about the dynamic block module or what it does, though, so I can't comment on that part.

I'm not really commenting on the Taxonomy: All Terms data being 'missing' because:

1) content_taxonomy does its own thing. AS I said, I don't know what it does exactly, so if it's changing the underlying data, I would expect Views to not work and
2) I have no idea how your fields are structured.

My immediate guess is that content taxonomy is doing something. I do not have a large amount of free time, so if I think another module is the source of the problem, that's where I'm forced to stop.

I can't help that content_taxonomy queue is not being maintained, unfortunately. There are lots of contributed modules that are maintained poorly. Heck, Views is probably one of them, when you consider that there are over 1300 open issues in the queue. There's just not enough time to cover everything.

druplicate’s picture

Thanks a bunch! That helps a lot just understanding the underlying method even a little bit.

I'll escalate the data missing issue to critical over at contax to see if that gets some attention.

I'm amazed you get to as much as you do.

Thanks again!