Multiple relationships to same content with different delta

fred0 - May 28, 2009 - 05:49
Project:Content Construction Kit (CCK)
Version:6.x-2.x-dev
Component:Views Integration
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi all, hoping someone can shed some light.
I am trying to create a view which has 3 relationships to the same content type using the same field but each with a different delta (1, 2 and 3 respectively) and then 3 fields of the same type each set up to use its respective relationship.

To start, the related content (called DVD Type) has 2 fields:
Name
Icon

My main content has a nodereference field that shows multiple-select check boxes for the 3 DVD Type nodes I created (Blu-Ray, Box Set, Multi-Disc).

The goal is to be able to check off 1 or more types and then, in the view, show a matching icon for each from the Icon field.

In testing:
If I have a single relationship and single icon field, I can change the delta of the relationship between 1, 2 and 3 and see the icon change to match.

If I have 3 relationships, each with it's own delta, and a single field, I can change which relationship the field uses and the icon will change in kind.

However, with 3 relationships, each with it's own delta as before, and 3 fields, each set to it's respective relationship, all 3 fields show the icon from the first field in the list. I was able to test this by rearranging the field order and seeing the icon change on all 3 fields to match the first field relationship.

Here's teh query itself for those interested:

SELECT node.nid AS nid, node_data_field_dvd_category.field_dvd_category_nid AS node_data_field_dvd_category_field_dvd_category_nid, node_node_data_field_dvd_category.nid AS node_node_data_field_dvd_category_nid, node_node_data_field_dvd_category.type AS node_node_data_field_dvd_category_type, node_node_data_field_dvd_category.vid AS node_node_data_field_dvd_category_vid, node_data_field_category_icon.field_category_icon_fid AS node_data_field_category_icon_field_category_icon_fid, node_data_field_category_icon.field_category_icon_list AS node_data_field_category_icon_field_category_icon_list, node_data_field_category_icon.field_category_icon_data AS node_data_field_category_icon_field_category_icon_data, node.title AS node_title, node.changed AS node_changed, node_data_field_dvd_distributor_initials.field_dvd_distributor_initials_value AS node_data_field_dvd_distributor_initials_field_dvd_distributor_initials_value, node.type AS node_type, node.vid AS node_vid, node_data_field_type_icon.field_type_icon_fid AS node_data_field_type_icon_field_type_icon_fid, node_data_field_type_icon.field_type_icon_list AS node_data_field_type_icon_field_type_icon_list, node_data_field_type_icon.field_type_icon_data AS node_data_field_type_icon_field_type_icon_data, node_node_data_field_dvd_type_2.nid AS node_node_data_field_dvd_type_2_nid, node_node_data_field_dvd_type_2.type AS node_node_data_field_dvd_type_2_type, node_node_data_field_dvd_type_2.vid AS node_node_data_field_dvd_type_2_vid, node_node_data_field_dvd_type.nid AS node_node_data_field_dvd_type_nid, node_node_data_field_dvd_type.type AS node_node_data_field_dvd_type_type, node_node_data_field_dvd_type.vid AS node_node_data_field_dvd_type_vid, node_node_data_field_dvd_type_1.nid AS node_node_data_field_dvd_type_1_nid, node_node_data_field_dvd_type_1.type AS node_node_data_field_dvd_type_1_type, node_node_data_field_dvd_type_1.vid AS node_node_data_field_dvd_type_1_vid FROM node node  LEFT JOIN content_type_film_dvd node_data_field_dvd_category ON node.vid = node_data_field_dvd_category.vid LEFT JOIN node node_node_data_field_dvd_category ON node_data_field_dvd_category.field_dvd_category_nid = node_node_data_field_dvd_category.nid LEFT JOIN content_field_dvd_type node_data_field_dvd_type ON node.vid = node_data_field_dvd_type.vid AND node_data_field_dvd_type.delta = 0 LEFT JOIN node node_node_data_field_dvd_type ON node_data_field_dvd_type.field_dvd_type_nid = node_node_data_field_dvd_type.nid LEFT JOIN content_field_dvd_type node_data_field_dvd_type2 ON node.vid = node_data_field_dvd_type2.vid AND node_data_field_dvd_type2.delta = 1 LEFT JOIN node node_node_data_field_dvd_type_1 ON node_data_field_dvd_type2.field_dvd_type_nid = node_node_data_field_dvd_type_1.nid LEFT JOIN content_field_dvd_type node_data_field_dvd_type3 ON node.vid = node_data_field_dvd_type3.vid AND node_data_field_dvd_type3.delta = 2 LEFT JOIN node node_node_data_field_dvd_type_2 ON node_data_field_dvd_type3.field_dvd_type_nid = node_node_data_field_dvd_type_2.nid LEFT JOIN content_type_category node_data_field_category_icon ON node_node_data_field_dvd_category.vid = node_data_field_category_icon.vid LEFT JOIN content_type_film_dvd node_data_field_dvd_distributor_initials ON node.vid = node_data_field_dvd_distributor_initials.vid LEFT JOIN content_type_type node_data_field_type_icon ON node_node_data_field_dvd_type_2.vid = node_data_field_type_icon.vid WHERE ((node.status <> 0) AND (node.type in ('film_dvd'))) AND ((DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node.changed), SEC_TO_TIME(-25200)), '%Y-%m') <= '2009-05' AND DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node.changed), SEC_TO_TIME(-25200)), '%Y-%m') >= '2009-05')) ORDER BY node_changed ASC

AttachmentSize
multiple_rel_field.png34.58 KB

#1

fred0 - May 28, 2009 - 05:58

Drat, posted the wrong sql query. Here's the right one without the extraneous fields:

SELECT node.nid AS nid, node.title AS node_title, node.changed AS node_changed, node_data_field_dvd_distributor_initials.field_dvd_distributor_initials_value AS node_data_field_dvd_distributor_initials_field_dvd_distributor_initials_value, node.type AS node_type, node.vid AS node_vid, node_data_field_type_icon.field_type_icon_fid AS node_data_field_type_icon_field_type_icon_fid, node_data_field_type_icon.field_type_icon_list AS node_data_field_type_icon_field_type_icon_list, node_data_field_type_icon.field_type_icon_data AS node_data_field_type_icon_field_type_icon_data, node_node_data_field_dvd_type.nid AS node_node_data_field_dvd_type_nid, node_node_data_field_dvd_type.type AS node_node_data_field_dvd_type_type, node_node_data_field_dvd_type.vid AS node_node_data_field_dvd_type_vid, node_node_data_field_dvd_type_1.nid AS node_node_data_field_dvd_type_1_nid, node_node_data_field_dvd_type_1.type AS node_node_data_field_dvd_type_1_type, node_node_data_field_dvd_type_1.vid AS node_node_data_field_dvd_type_1_vid, node_node_data_field_dvd_type_2.nid AS node_node_data_field_dvd_type_2_nid, node_node_data_field_dvd_type_2.type AS node_node_data_field_dvd_type_2_type, node_node_data_field_dvd_type_2.vid AS node_node_data_field_dvd_type_2_vid FROM node node  LEFT JOIN content_field_dvd_type node_data_field_dvd_type ON node.vid = node_data_field_dvd_type.vid AND node_data_field_dvd_type.delta = 0 LEFT JOIN node node_node_data_field_dvd_type ON node_data_field_dvd_type.field_dvd_type_nid = node_node_data_field_dvd_type.nid LEFT JOIN content_field_dvd_type node_data_field_dvd_type2 ON node.vid = node_data_field_dvd_type2.vid AND node_data_field_dvd_type2.delta = 1 LEFT JOIN node node_node_data_field_dvd_type_1 ON node_data_field_dvd_type2.field_dvd_type_nid = node_node_data_field_dvd_type_1.nid LEFT JOIN content_field_dvd_type node_data_field_dvd_type3 ON node.vid = node_data_field_dvd_type3.vid AND node_data_field_dvd_type3.delta = 2 LEFT JOIN node node_node_data_field_dvd_type_2 ON node_data_field_dvd_type3.field_dvd_type_nid = node_node_data_field_dvd_type_2.nid LEFT JOIN content_type_film_dvd node_data_field_dvd_distributor_initials ON node.vid = node_data_field_dvd_distributor_initials.vid LEFT JOIN content_type_type node_data_field_type_icon ON node_node_data_field_dvd_type.vid = node_data_field_type_icon.vid WHERE ((node.status <> 0) AND (node.type in ('film_dvd'))) AND ((DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node.changed), SEC_TO_TIME(-25200)), '%Y-%m') <= '2009-05' AND DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node.changed), SEC_TO_TIME(-25200)), '%Y-%m') >= '2009-05')) ORDER BY node_changed ASC

#2

Gurpartap Singh - August 7, 2009 - 08:55
Category:support request» bug report

I had exactly the same issue today. I had to eventually create a separate view for each relationship, then merge them together to call it a single view's result.

#3

gausarts - September 17, 2009 - 02:28

Tracking for the same issue I have

#4

askibinski - November 6, 2009 - 14:36

I had exactly the same issue.
No matter what delta I used, it always returned the first image.

I did a workaround by creating a separate attachment view for each one, which worked fine.

#5

dereine - November 6, 2009 - 17:28
Project:Views» Content Construction Kit (CCK)
Version:6.x-2.x-dev» 6.x-2.x-dev
Component:Miscellaneous» Views Integration

I think this is a problem of the cck integration

 
 

Drupal is a registered trademark of Dries Buytaert.