I have a view of nodes that only shows two fields: the taxonomy terms from a selected vocabulary (1 out of 3 available vocabularies) and an integer. I wish to get a sum of the integers grouped by taxonomy term. When I do that, I get this error instead of a graph:
user warning: Unknown column 'unknown' in 'order clause' query: SELECT ROUND(COUNT(node_data_field_hours.field_hours_value), 2) AS field_hours_value, term_node.tid AS term_node_tid FROM issuetracker_node node LEFT JOIN issuetracker_content_type_time_track node_data_field_hours ON node.vid = node_data_field_hours.vid LEFT JOIN issuetracker_content_type_time_track node_data_field_hours2 ON node.vid = node_data_field_hours2.vid LEFT JOIN issuetracker_term_node term_node ON node.vid = term_node.vid WHERE node.type in ('time_track') GROUP BY term_node.tid ORDER BY unknown ASC in /var/www/drupal/sites/issuetracker/modules/views/includes/view.inc on line 759.
Here's the view export:
$view = new view;
$view->name = 'chart';
$view->description = '';
$view->tag = '';
$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('fields', array(
'field_hours_value' => array(
'label' => 'Hours',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'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_hours_value',
'table' => 'node_data_field_hours',
'field' => 'field_hours_value',
'relationship' => 'none',
),
'tid' => array(
'label' => 'All terms',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'link_to_taxonomy' => 1,
'limit' => 1,
'vids' => array(
'9' => 9,
'5' => 0,
'7' => 0,
'8' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'time_track' => 'time_track',
),
'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('cache', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'chart');
$handler->override_option('style_options', array(
'grouping' => '',
'charts' => array(
'#plugin' => 'google',
'#type' => 'pie2D',
'#width' => '400',
'#height' => '200',
'#color_palette' => '#ffffff,#000000,#ff0000,#00cc00,#0066b3,#ff8000,#ffcc00,#330099,#990099,#ccff00',
),
'show_legend' => 1,
'show_sums' => 1,
'aggregation_field' => 'tid',
'calc_fields' => 'field_hours_value',
'calc' => 'COUNT',
'precision' => '2',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'chart');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comments
Comment #1
jfev commentedDid you ever find a solution to this?
Comment #2
quicksketchPlease reopen if this problem exists in the D7 version of the module. The 6.x-1.x version of the module is no longer being updated. In D7 (and Views 3) support for aggregated queries is significantly better.