Hi there,

Just upgraded to the latest version and noticed the following:

I have 2 custom content types:
- Team (contains a cck text field with the team name)
- Game

The 'Game' content type has two cck node reference fields:
- Home: points to a team
- Away: also points to a team

I tried creating a view that shows all games for a team. In order to display the home and away team names, I added 2 relationships with different labels. I then added two fields using these relationships. Unfortunately, the view displays the same team name twice, so it seems to be using only 1 of the relationships. If I reorder the relationships, the team names change to the name of the first relationship.

I noticed a similar type of issue that has been created earlier, but should've been fixed: http://drupal.org/node/286553

Any idea if:
- I'm doing something wrong?
- This is a limitation of Views?
- This is a bug?

Cheers!

Joris

Comments

dawehner’s picture

its incredible hard to help you if you don't export your view, because i can't guess whether you did something wrong or not

osieke’s picture

Here you go:

$view = new view;
$view->name = 'ploeg_wedstrijden';
$view->description = 'De wedstrijden van een ploeg in een competitie.';
$view->tag = 'ploeg_wedstrijden';
$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_wedstrijd_thuis_nid' => array(
    'label' => 'Thuisploeg',
    'required' => 0,
    'delta' => -1,
    'id' => 'field_wedstrijd_thuis_nid',
    'table' => 'node_data_field_wedstrijd_thuis',
    'field' => 'field_wedstrijd_thuis_nid',
    'relationship' => 'none',
  ),
  'field_wedstrijd_bezoekers_nid' => array(
    'label' => 'Bezoekers',
    'required' => 0,
    'delta' => -1,
    'id' => 'field_wedstrijd_bezoekers_nid',
    'table' => 'node_data_field_wedstrijd_bezoekers',
    'field' => 'field_wedstrijd_bezoekers_nid',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'field_wedstrijd_datum_value' => array(
    'label' => 'Datum',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'both',
    ),
    'exclude' => 0,
    'id' => 'field_wedstrijd_datum_value',
    'table' => 'node_data_field_wedstrijd_datum',
    'field' => 'field_wedstrijd_datum_value',
    'relationship' => 'none',
  ),
  'field_ploeg_naam_value' => array(
    'label' => 'Ploegnaam',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_ploeg_naam_value',
    'table' => 'node_data_field_ploeg_naam',
    'field' => 'field_ploeg_naam_value',
    'relationship' => 'field_wedstrijd_thuis_nid',
  ),
  'field_ploeg_naam_value_1' => array(
    'label' => 'Ploegnaam',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_ploeg_naam_value_1',
    'table' => 'node_data_field_ploeg_naam',
    'field' => 'field_ploeg_naam_value',
    'relationship' => 'field_wedstrijd_bezoekers_nid',
  ),
));
$handler->override_option('arguments', array(
  'tid' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'php',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'empty',
    'break_phrase' => 1,
    'add_table' => 0,
    'require_value' => 0,
    'reduce_duplicates' => 0,
    'set_breadcrumb' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '$node=node_load(arg(1));
    if($node){
    foreach($node->taxonomy as $term){$terms[]=$term->tid;}
    if ($terms) {
    return implode(\',\',$terms);
    } else { return; }
    }else {return;}',
    'validate_argument_node_type' => array(
      'lid' => 0,
      'page' => 0,
      'ploeg' => 0,
      'speler' => 0,
      'story' => 0,
      'wedstrijd' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'user_argument_type' => '',
    'restrict_user_roles' => 0,
    'user_roles' => array(),
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'wedstrijd' => 'wedstrijd',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('empty', 'Er werden geen wedstrijden gevonden voor deze ploeg.');
$handler->override_option('empty_format', '1');
osieke’s picture

And here's the SQL:

SELECT node.nid AS nid, node_data_field_wedstrijd_datum.field_wedstrijd_datum_value AS node_data_field_wedstrijd_datum_field_wedstrijd_datum_value, node.type AS node_type, node.vid AS node_vid, node_data_field_ploeg_naam.field_ploeg_naam_value AS node_data_field_ploeg_naam_field_ploeg_naam_value, node_node_data_field_wedstrijd_thuis.nid AS node_node_data_field_wedstrijd_thuis_nid, node_node_data_field_wedstrijd_thuis.type AS node_node_data_field_wedstrijd_thuis_type, node_node_data_field_wedstrijd_thuis.vid AS node_node_data_field_wedstrijd_thuis_vid, node_node_data_field_wedstrijd_bezoekers.nid AS node_node_data_field_wedstrijd_bezoekers_nid, node_node_data_field_wedstrijd_bezoekers.type AS node_node_data_field_wedstrijd_bezoekers_type, node_node_data_field_wedstrijd_bezoekers.vid AS node_node_data_field_wedstrijd_bezoekers_vid FROM node node LEFT JOIN content_type_wedstrijd node_data_field_wedstrijd_thuis ON node.vid = node_data_field_wedstrijd_thuis.vid LEFT JOIN node node_node_data_field_wedstrijd_thuis ON node_data_field_wedstrijd_thuis.field_wedstrijd_thuis_nid = node_node_data_field_wedstrijd_thuis.nid LEFT JOIN content_type_wedstrijd node_data_field_wedstrijd_bezoekers ON node.vid = node_data_field_wedstrijd_bezoekers.vid INNER JOIN node node_node_data_field_wedstrijd_bezoekers ON node_data_field_wedstrijd_bezoekers.field_wedstrijd_bezoekers_nid = node_node_data_field_wedstrijd_bezoekers.nid INNER JOIN term_node term_node_value_0 ON node.vid = term_node_value_0.vid AND term_node_value_0.tid = 4 INNER JOIN term_node term_node_value_1 ON node.vid = term_node_value_1.vid AND term_node_value_1.tid = 9 LEFT JOIN content_type_wedstrijd node_data_field_wedstrijd_datum ON node.vid = node_data_field_wedstrijd_datum.vid LEFT JOIN content_type_ploeg node_data_field_ploeg_naam ON node_node_data_field_wedstrijd_thuis.vid = node_data_field_ploeg_naam.vid WHERE (node.status <> 0) AND (node.type in ('wedstrijd')) AND (term_node_value_0.tid = 4 AND term_node_value_1.tid = 9)

merlinofchaos’s picture

Does quicksketch's patch in http://drupal.org/node/317271#comment-1459264 fix this?

osieke’s picture

Yes it does! Thank you very much for your support. Is this something that might get incorporated into views?

merlinofchaos’s picture

Status: Active » Closed (duplicate)

It will be in 2.6. (I just released 2.5 and didn't get this one in, but with the patch available you can run a patch version until 2.6 is out)