Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.0-rc1
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Jul 2008 at 03:33 UTC
Updated:
28 Aug 2008 at 22:22 UTC
So, in light of the closing of issue http://drupal.org/node/284898 , I decided to implement separate cck nodereference fields for each instructor of a section. So, my content type Section now has cck nodereferences for field_instructor1 and field_instructor2. Just to reorient, this is what I'm looking for:
Section 1 - M 4-5 -100 Willy Wonka Hall
Jim - [Data from Jim's Instructor Node, such as his previous experience]
Bob - [Data from Bob's Instructor Node, such as his previous experience]
Ok, so I figure that I just go to my view, add two relationships, one for instructor1 and instructor2, and have two namefields, each pointing to a relationship. I add the two relationships, and when I add my first field and point it to instructor1, I get not just 1 SQL error, but two of them.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= node_node_data_field_instructor2.nid LEFT JOIN trace_content_field_name node_' at line 8 query: SELECT COUNT(*) FROM (SELECT node.nid AS nid, node.type AS node_type, node_data_field_name.field_name_value AS node_data_field_name_field_name_value, node_data_field_name.nid AS node_data_field_name_nid FROM trace_node node LEFT JOIN trace_content_type_e98_section node_data_field_instructor1 ON node.vid = node_data_field_instructor1.vid LEFT JOIN trace_node node_node_data_field_instructor1 ON node_data_field_instructor1.field_instructor1_nid = node_node_data_field_instructor1.nid LEFT JOIN trace_node node_node_data_field_instructor2 ON .field_instructor2_nid = node_node_data_field_instructor2.nid LEFT JOIN trace_content_field_name node_data_field_name ON node.vid = node_data_field_name.vid ) AS count_alias in D:\xampplite\htdocs\sites\all\modules\views\includes\view.inc on line 652.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= node_node_data_field_instructor2.nid LEFT JOIN trace_content_field_name node_' at line 8 query: SELECT node.nid AS nid, node.type AS node_type, node_data_field_name.field_name_value AS node_data_field_name_field_name_value, node_data_field_name.nid AS node_data_field_name_nid FROM trace_node node LEFT JOIN trace_content_type_e98_section node_data_field_instructor1 ON node.vid = node_data_field_instructor1.vid LEFT JOIN trace_node node_node_data_field_instructor1 ON node_data_field_instructor1.field_instructor1_nid = node_node_data_field_instructor1.nid LEFT JOIN trace_node node_node_data_field_instructor2 ON .field_instructor2_nid = node_node_data_field_instructor2.nid LEFT JOIN trace_content_field_name node_data_field_name ON node.vid = node_data_field_name.vid LIMIT 0, 10 in D:\xampplite\htdocs\sites\all\modules\views\includes\view.inc on line 677.
I have no idea what to do. Actual SQL query and views export is below
Query:
SELECT node.nid AS nid,
node.type AS node_type,
node_data_field_name.field_name_value AS node_data_field_name_field_name_value,
node_data_field_name.nid AS node_data_field_name_nid
FROM trace_node node
LEFT JOIN trace_content_type_e98_section node_data_field_instructor1 ON node.vid = node_data_field_instructor1.vid
LEFT JOIN trace_node node_node_data_field_instructor1 ON node_data_field_instructor1.field_instructor1_nid = node_node_data_field_instructor1.nid
LEFT JOIN trace_node node_node_data_field_instructor2 ON .field_instructor2_nid = node_node_data_field_instructor2.nid
LEFT JOIN trace_content_field_name node_data_field_name ON node.vid = node_data_field_name.vid
$view = new view;
$view->name = 'test';
$view->description = 'Used to troubleshoot other views';
$view->tag = 'test';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'field_instructor1_nid' => array(
'label' => 'field_instructor1_nid',
'required' => 0,
'id' => 'field_instructor1_nid',
'table' => 'node_data_field_instructor1',
'field' => 'field_instructor1_nid',
'relationship' => 'none',
),
'field_instructor2_nid' => array(
'label' => 'field_instructor2_nid',
'required' => 0,
'id' => 'field_instructor2_nid',
'table' => 'node_data_field_instructor2',
'field' => 'field_instructor2_nid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'field_name_value' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_name_value',
'table' => 'node_data_field_name',
'field' => 'field_name_value',
'relationship' => 'field_instructors_nid',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
Comments
Comment #1
carnive commentedSome additional info I forgot to mention:
nodereferences are single value
Views is version 6.x-2.0-rc1
CCK Content Type Section is exported below:
Comment #2
carnive commentedWas in the CCK queue, but nothing seemed to be happening there, and I think it's a Views issue anyway...
Apologies if it is, indeed, a CCK issue.
Comment #3
merlinofchaos commentedThis should now be fixed in -dev.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.