The Crosstab Table views style does not appear to be configured.

Created on 26 February 2015, over 9 years ago
Updated 13 December 2023, 7 months ago

Background
I created a brand new d7.34 site.
I loaded ctools, view, views crosstab, admin_menu, and module_filter modules.
I then created a simple content type called cross tab, which consist of the following three fields:

  1. Category, which is a text field. This is the cross tab column.
  2. Squadron, which is a text field. This is the cross tab row
  3. Total amount, which is a decimal field (amount). This is the cross tab data

I then entered about 20 cross tab content types.
I then build a simple table view to display the cross tabs content types and the worked fine.

Here is the SQL for the simple table view:

SELECT node.nid AS nid,
'node' AS field_data_field_ct_squadron_node_entity_type,
'node' AS field_data_field_ct_category_node_entity_type,
'node' AS field_data_field_ct_total_amount_node_entity_type
FROM {node} node
WHERE (( (node.status = '1') AND (node.type IN ('cross_tab')) ))

The view worked fine.

Cross tab view
I then changed that view to a view cross tab and that is the only change I make. When I change the view to a view cross tab, I set the cross tab fields as specified above and I get the error message "The Crosstab Table views style does not appear to be configured."

The sql for the cross tab report is:
SELECT 'node' AS field_data_field_ct_squadron_node_entity_type,
'node' AS field_data_field_ct_category_node_entity_type,
'node' AS field_data_field_ct_total_amount_node_entity_type
FROM {node} node
WHERE (( (node.status = '1') AND (node.type IN ('cross_tab')) ))

I put in some debugging statements within the code. The reason the error is being displayed is the values for the following fields are not set:

  • !isset($crosstab_rows[field] is not set
  • !isset($crosstab_columns[field] is not set
  • !isset($crosstab_columns[field] is not set

Here is a export of the view:

$view = new view();
$view->name = 'cross_tab_report';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'cross tab report';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'cross tab report';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'views_crosstab_table';
$handler->display->display_options['style_options']['columns'] = array(
'field_ct_squadron' => 'field_ct_squadron',
'field_ct_category' => 'field_ct_category',
'field_ct_total_amount' => 'field_ct_total_amount',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'field_ct_squadron' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'field_ct_category' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'field_ct_total_amount' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
$handler->display->display_options['style_options']['crosstab_rows'] = 'field_ct_squadron';
$handler->display->display_options['style_options']['crosstab_columns'] = 'field_ct_category';
$handler->display->display_options['style_options']['crosstab_data'] = 'field_ct_total_amount';
$handler->display->display_options['style_options']['crosstab_operation'] = 'SUM';
/* Field: Content: Squadron */
$handler->display->display_options['fields']['field_ct_squadron']['id'] = 'field_ct_squadron';
$handler->display->display_options['fields']['field_ct_squadron']['table'] = 'field_data_field_ct_squadron';
$handler->display->display_options['fields']['field_ct_squadron']['field'] = 'field_ct_squadron';
/* Field: Content: Category */
$handler->display->display_options['fields']['field_ct_category']['id'] = 'field_ct_category';
$handler->display->display_options['fields']['field_ct_category']['table'] = 'field_data_field_ct_category';
$handler->display->display_options['fields']['field_ct_category']['field'] = 'field_ct_category';
/* Field: Content: Total amount */
$handler->display->display_options['fields']['field_ct_total_amount']['id'] = 'field_ct_total_amount';
$handler->display->display_options['fields']['field_ct_total_amount']['table'] = 'field_data_field_ct_total_amount';
$handler->display->display_options['fields']['field_ct_total_amount']['field'] = 'field_ct_total_amount';
$handler->display->display_options['fields']['field_ct_total_amount']['settings'] = array(
'thousand_separator' => ',',
'decimal_separator' => '.',
'scale' => '2',
'prefix_suffix' => 1,
);
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'cross_tab' => 'cross_tab',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'cross-tab-report';

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States densolis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024