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

carnive’s picture

Category: bug » support

Some 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:

$content[type]  = array (
  'name' => 'E98 Section',
  'type' => 'e98_section',
  'description' => '',
  'title_label' => 'URL',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => false,
    'sticky' => false,
    'revision' => false,
  ),
  'upload' => '0',
  'old_type' => 'e98_section',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'comment' => '0',
  'comment_default_mode' => '4',
  'comment_default_order' => '1',
  'comment_default_per_page' => '50',
  'comment_controls' => '3',
  'comment_anonymous' => 0,
  'comment_subject_field' => '1',
  'comment_preview' => '1',
  'comment_form_location' => '0',
);
$content[fields]  = array (
  0 => 
  array (
    'label' => 'Name',
    'field_name' => 'field_name',
    'type' => 'text',
    'widget_type' => 'text_textfield',
    'change' => 'Change basic information',
    'weight' => '-4',
    'rows' => 1,
    'description' => '',
    'default_value_widget' => 
    array (
      'field_name' => 
      array (
        0 => 
        array (
          'value' => 'Name as you want to appear on your bio',
          '_error_element' => 'default_value_widget][field_name][0][value',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'module' => 'text',
    'widget_module' => 'text',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'default_value' => 
    array (
      0 => 
      array (
        'value' => 'Name as you want to appear on your bio',
        '_error_element' => 'default_value_widget][field_name][0][value',
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
  1 => 
  array (
    'label' => 'Semester and Year',
    'field_name' => 'field_semesterandyear',
    'type' => 'text',
    'widget_type' => 'optionwidgets_select',
    'change' => 'Change basic information',
    'weight' => '-3',
    'description' => '',
    'default_value_widget' => 
    array (
      'field_semesterandyear' => 
      array (
        'value' => 'Fall 2008',
        '_error_element' => 'default_value_widget][field_semesterandyear][value',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => 'Fall 2008',
    'allowed_values_php' => '',
    'module' => 'text',
    'widget_module' => 'optionwidgets',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
  2 => 
  array (
    'label' => 'Time',
    'field_name' => 'field_section_time',
    'type' => 'text',
    'widget_type' => 'text_textfield',
    'change' => 'Change basic information',
    'weight' => '-1',
    'rows' => 1,
    'description' => '',
    'default_value_widget' => 
    array (
      'field_section_time' => 
      array (
        0 => 
        array (
          'value' => '',
          '_error_element' => 'default_value_widget][field_section_time][0][value',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'module' => 'text',
    'widget_module' => 'text',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
  3 => 
  array (
    'label' => 'Instructor 1',
    'field_name' => 'field_instructor1',
    'type' => 'nodereference',
    'widget_type' => 'nodereference_select',
    'change' => 'Change basic information',
    'weight' => '',
    'description' => '',
    'default_value_widget' => 
    array (
      'field_instructor1' => 
      array (
        0 => 
        array (
          'nid' => '',
          '_error_element' => 'default_value_widget][field_instructor1][nid][nid',
        ),
        'nid' => 
        array (
          'nid' => '',
          '_error_element' => 'default_value_widget][field_instructor1][nid][nid',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'referenceable_types' => 
    array (
      'e98_section_bio' => true,
      0 => 1,
      'book' => false,
      'e98_section' => false,
      'essay' => false,
      'forum' => false,
      'page' => false,
      'poll' => false,
      'story' => false,
    ),
    'advanced_view' => 'select_instructors_for_section',
    'advanced_view_args' => '',
    'module' => 'nodereference',
    'widget_module' => 'nodereference',
    'columns' => 
    array (
      'nid' => 
      array (
        'type' => 'int',
        'unsigned' => true,
        'not null' => false,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
  4 => 
  array (
    'label' => 'Instructor 2',
    'field_name' => 'field_instructor2',
    'type' => 'nodereference',
    'widget_type' => 'nodereference_select',
    'change' => 'Change basic information',
    'weight' => '',
    'description' => '',
    'default_value_widget' => 
    array (
      'field_instructor2' => 
      array (
        0 => 
        array (
          'nid' => '',
          '_error_element' => 'default_value_widget][field_instructor2][nid][nid',
        ),
        'nid' => 
        array (
          'nid' => '',
          '_error_element' => 'default_value_widget][field_instructor2][nid][nid',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'referenceable_types' => 
    array (
      'e98_section_bio' => true,
      0 => 1,
      'book' => false,
      'e98_section' => false,
      'essay' => false,
      'forum' => false,
      'page' => false,
      'poll' => false,
      'story' => false,
    ),
    'advanced_view' => 'select_instructors_for_section',
    'advanced_view_args' => '',
    'module' => 'nodereference',
    'widget_module' => 'nodereference',
    'columns' => 
    array (
      'nid' => 
      array (
        'type' => 'int',
        'unsigned' => true,
        'not null' => false,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
  5 => 
  array (
    'label' => 'Location',
    'field_name' => 'field_section_location',
    'type' => 'text',
    'widget_type' => 'text_textfield',
    'change' => 'Change basic information',
    'weight' => '',
    'rows' => 1,
    'description' => '',
    'default_value_widget' => 
    array (
      'field_section_location' => 
      array (
        0 => 
        array (
          'value' => '',
          '_error_element' => 'default_value_widget][field_section_location][0][value',
        ),
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '1',
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'module' => 'text',
    'widget_module' => 'text',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
      ),
      'full' => 
      array (
        'format' => 'default',
      ),
      4 => 
      array (
        'format' => 'default',
      ),
      2 => 
      array (
        'format' => 'default',
      ),
      3 => 
      array (
        'format' => 'default',
      ),
    ),
  ),
);
carnive’s picture

Project: Content Construction Kit (CCK) » Views (for Drupal 7)
Version: 6.x-2.0-rc4 » 6.x-2.0-rc1
Component: Views Integration » Miscellaneous

Was 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.

merlinofchaos’s picture

Category: support » bug
Status: Active » Fixed

This should now be fixed in -dev.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.