hi there: this view

$view = new view;
$view->name = 'fooo';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'term_data';
$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('fields', array(
  'tid' => array(
    'label' => 'All terms',
    'type' => 'separator',
    'separator' => ', ',
    'empty' => '',
    'link_to_taxonomy' => 1,
    'limit' => 0,
    'vids' => array(
      '1' => 0,
      '3' => 0,
      '2' => 0,
      '4' => 0,
      '5' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => 'Vocabulary name',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'vocabulary',
    'field' => 'name',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('use_more', 1);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'grouping' => 'name',
  'type' => 'ul',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'fooo');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler = $view->new_display('block', 'Block', 'block_1');

fails with

    * user warning: Column 'vid' in field list is ambiguous query: SELECT COUNT(*) FROM (SELECT term_data.tid AS tid, vid, vocabulary.name AS vocabulary_name FROM term_data term_data LEFT JOIN vocabulary vocabulary ON term_data.vid = vocabulary.vid ) AS count_alias in /drupal/sites/all/modules/views/includes/view.inc on line 652.
    * user warning: Column 'vid' in field list is ambiguous query: SELECT term_data.tid AS tid, vid, vocabulary.name AS vocabulary_name FROM term_data term_data LEFT JOIN vocabulary vocabulary ON term_data.vid = vocabulary.vid LIMIT 0, 10 in /drupal/sites/all/modules/views/includes/view.inc on line 677.

on query

SELECT term_data.tid AS tid,
   vid,
   vocabulary.name AS vocabulary_name
 FROM term_data term_data 
 LEFT JOIN vocabulary vocabulary ON term_data.vid = vocabulary.vid

because there is a missing join between node and term_data tables.. sorry i don't understand the code good enough yet to provide a patch that's about all i could find out! regards.

Comments

mooffie’s picture

$view->base_table = 'term_data';
...
$handler->override_option('fields', array(
  'tid' => array(
    'label' => 'All terms',

There's no point in showing the 'All terms' pseudo field in a 'term_data' view. That's because the 'All terms' field shows all terms in a node, whereas a 'term_data' view doesn't deal with nodes.

One way to solve this is to move the definition of 'All terms' to the 'node' table. But this will break existing views of hundreds of users.

eMPee584’s picture

Status: Active » Closed (works as designed)

ah ok thx for explaining that mooffie..
now i have a different issue: i want to create a cck field that really is a cck fieldgroup containing a noderef field and a custom field.. you wouldn't have an idea how to accomplish that would you?

mooffie’s picture

Status: Closed (works as designed) » Active

I've reverting to 'active' since this is still a bug. And maybe I erred in what I wrote; Merlin is the authority here.

As for your other, CCK question: you should ask this in a separate post, and the fourms, or CCK's issue queue, are a better place. One of the desired features of CCK is "compound fields" (or "combo fields"), but I'm afraid CCK for D6 doesn't help much here --though there are some useful hints around, search e.g. for 'drupal cck compound fields'.

merlinofchaos’s picture

Mooffie: You're pretty much correct. That field is in the wrong place. I'm going to have to play some tricks to move it where it is supposed to be.

In the query, it's supposed to be 'node.vid' but there is no 'node' in the query.

mooffie’s picture

I think we can solve this problem by putting a 'skip base' => 'term_data' in the definition of this 'All terms' field. I'll investigate this after my patch to fix that 'skip base' feature gets in.

merlinofchaos’s picture

Status: Active » Fixed

Fixed using the skip base method.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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