A multigroup has two fields:
field_roleplay_participants (user reference)
field_roleplay_characters (node reference)

I have a view showing both, and am trying to show the teaser of the nodes referenced in field_roleplay_characters.
I can either have a relationship, or the multigroup filter. If I have both at once, the following sql error is thrown:

Unknown column 'node_data_field_roleplay_participants.delta' in 'on clause' query: SELECT node.nid AS nid, node_data_field_roleplay_participants.field_roleplay_participants_uid AS node_data_field_roleplay_participants_field_roleplay_participants_uid, node_data_field_roleplay_participants.delta AS node_data_field_roleplay_participants_delta, node.type AS node_type, node.vid AS node_vid, node_data_field_roleplay_characters.field_roleplay_characters_nid AS node_data_field_roleplay_characters_field_roleplay_characters_nid, node_data_field_roleplay_characters.delta AS node_data_field_roleplay_characters_delta, node_node_data_field_roleplay_characters__node_revisions.teaser AS node_node_data_field_roleplay_characters__node_revisions_teaser, node_node_data_field_roleplay_characters__node_revisions.format AS node_node_data_field_roleplay_characters__node_revisions_format FROM node node LEFT JOIN content_field_roleplay_characters node_data_field_roleplay_characters ON node.vid = node_data_field_roleplay_characters.vid AND (node_data_field_roleplay_participants.delta = node_data_field_roleplay_characters.delta) INNER JOIN node node_node_data_field_roleplay_characters ON node_data_field_roleplay_characters.field_roleplay_characters_nid = node_node_data_field_roleplay_characters.nid LEFT JOIN content_field_roleplay_participants node_data_field_roleplay_participants ON node.vid = node_data_field_roleplay_participants.vid LEFT JOIN node_revisions node_node_data_field_roleplay_characters__node_revisions ON node_node_data_field_roleplay_characters.vid = node_node_data_field_roleplay_characters__node_revisions.vid WHERE node.type in ('roleplay') LIMIT 0, 25 

View export:

$view = new view;
$view->name = 'roleplay_characters';
$view->description = 'Show characters in a roleplay';
$view->tag = 'Roleplay, Character';
$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_roleplay_characters_nid' => array(
    'label' => 'Character',
    'required' => 1,
    'delta' => '-1',
    'id' => 'field_roleplay_characters_nid',
    'table' => 'node_data_field_roleplay_characters',
    'field' => 'field_roleplay_characters_nid',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'field_roleplay_participants_uid' => array(
    'label' => 'Participant',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => 0,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 1,
    'id' => 'field_roleplay_participants_uid',
    'table' => 'node_data_field_roleplay_participants',
    'field' => 'field_roleplay_participants_uid',
    'relationship' => 'none',
  ),
  'field_roleplay_characters_nid' => array(
    'label' => 'Character',
    'alter' => array(
      'alter_text' => 1,
      'text' => '[field_roleplay_characters_nid] ([field_roleplay_participants_uid])',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'widget',
    'format' => 'default',
    'multiple' => array(
      'group' => 0,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_roleplay_characters_nid',
    'table' => 'node_data_field_roleplay_characters',
    'field' => 'field_roleplay_characters_nid',
    'relationship' => 'none',
  ),
  'teaser' => array(
    'label' => 'Bio',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '255',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'teaser',
    'table' => 'node_revisions',
    'field' => 'teaser',
    'relationship' => 'field_roleplay_characters_nid',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'roleplay' => 'roleplay',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'multigroup_roleplay_group_characters' => array(
    'operator' => '=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'content_multigroup_master_field' => 'node_data_field_roleplay_participants',
    'id' => 'multigroup_roleplay_group_characters',
    'table' => 'node',
    'field' => 'multigroup_roleplay_group_characters',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Characters');
$handler->override_option('items_per_page', 25);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'field_roleplay_participants_uid' => 'field_roleplay_participants_uid',
    'field_roleplay_characters_nid' => 'field_roleplay_characters_nid',
    'teaser' => 'teaser',
  ),
  'info' => array(
    'field_roleplay_participants_uid' => array(
      'separator' => '',
    ),
    'field_roleplay_characters_nid' => array(
      'separator' => ' ',
    ),
    'teaser' => array(
      'separator' => '',
    ),
  ),
  'default' => '-1',
));
CommentFileSizeAuthor
#6 01patch.diff593 bytesgleb22
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markus_petrux’s picture

hmm... it seems the table related to the relationship is queued before the table of the master field, hence the additional conditions to sync deltas are placed before the join of the master table is defined.

Try changing the field in the multigroup filter options.

I'm not sure what can we do to ensure the master field table is queued before tables related to relationships.

OliverColeman’s picture

I'm having the same issue. I tried changing the field in the multigroup filter to no avail. Any other ideas?

KarenS’s picture

Another report was marked as a duplicate at #620962: Multigroup filter producing duplicates with relationships.

mattcasey’s picture

Have the same error using Views 3.x and CCK 3.x, my two fields are both node relationships and when I try to select the second field for the Multigroup filter, it doesn't save, so I'm not sure if it would make any difference. Tried selecting different combinations of 'Distinct' query, 'Use Grouping', and 'Group multiples' for each field, but it seems like a patch is needed for this fix.

aquanox24’s picture

Same Problem, subscribing

gleb22’s picture

FileSize
593 bytes
aquanox24’s picture

Thank You. Patch #6 works for me.